some comments added + fixed a missing square bracket

This commit is contained in:
ahmadbilalkhalid 2019-08-23 11:25:40 +00:00
parent d7ada99c7a
commit edfc455de4

View file

@ -1,9 +1,22 @@
#!/bin/sh
# Functions
get_distro() {
OS=$(cat /etc/*release | grep ID | head -1 | cut -c 4-)
echo $OS
}
# Main Code Starts here
# Some common path variable declaration
ssh_authorized_keys_path='/root/.ssh/authorized_keys'
ssh_config_path='/etc/ssh/ssh_config'
sshd_config_path='/etc/ssh/sshd_config'
# Check if rdnssd is installed, if not put ungleich DNS
# into /etc/resolv.conf and install rdnssd for the next time
if ! $(which rdnssd); then
echo "nameserver 2a0a:e5c0::3" >> /etc/resolv.conf
echo "nameserver 2a0a:e5c0::4" >> /etc/resolv.conf
@ -11,16 +24,14 @@ if ! $(which rdnssd); then
apk add ndisc6
fi
# Get IPv6 DNS
# Start rdnssd to get DNS
rdnssd -u root -r /etc/resolv.conf
ssh_authorized_keys_path='/root/.ssh/authorized_keys'
ssh_config_path='/etc/ssh/ssh_config'
sshd_config_path='/etc/ssh/sshd_config'
# Initial Package Intallation
if [ [ $(get_distro) = "alpine" ]; then
if [[ $(get_distro) = "alpine" ]]; then
apk update
apk add python3 openssh-server sfdisk util-linux jq
apk add openssh-server sfdisk util-linux jq
touch $ssh_authorized_keys_path
if ! grep -q "PasswordAuthentication no" $ssh_config_path; then