blob: 315626b7b42367970611f0f6ab5ab5e63a8d8d6c [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301#!/bin/bash
2#
3# Copyright 2019-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18SUDO=''
19[[ $EUID -ne 0 ]] && SUDO=sudo
20
21install_run_pkg_deps() {
22 $SUDO apt-get update && $SUDO apt-get install -y \
23 openssl \
24 libidn11 \
25 libgnutls30 \
26 libsctp1 \
27 openssh-server
28}
29
30install_run_utils() {
31 $SUDO apt-get update && $SUDO apt-get install -y \
32 jq \
33 dnsutils \
34 iproute2 \
35 iputils-ping \
36 tcpdump
37}
38
39install_ssh_server() {
40 $SUDO mkdir /var/run/sshd
41 echo 'root:mypass' | chpasswd
42 sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
43 sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
44 echo "export VISIBLE=now" >> /etc/profile
45}
46
47cleanup_image() {
48 $SUDO rm -rf /var/lib/apt/lists/*
49}
50
51install_run_deps() {
52 install_run_pkg_deps
53 install_ssh_server
54}
55
56(return 2>/dev/null) && echo "Sourced" && return
57
58set -o errexit
59set -o pipefail
60set -o nounset
61
62install_run_deps
63echo "Dependency install completed"