some comments added + fixed a missing square bracket
This commit is contained in:
parent
d7ada99c7a
commit
edfc455de4
1 changed files with 17 additions and 6 deletions
|
@ -1,9 +1,22 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
|
||||||
get_distro() {
|
get_distro() {
|
||||||
OS=$(cat /etc/*release | grep ID | head -1 | cut -c 4-)
|
OS=$(cat /etc/*release | grep ID | head -1 | cut -c 4-)
|
||||||
echo $OS
|
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
|
if ! $(which rdnssd); then
|
||||||
echo "nameserver 2a0a:e5c0::3" >> /etc/resolv.conf
|
echo "nameserver 2a0a:e5c0::3" >> /etc/resolv.conf
|
||||||
echo "nameserver 2a0a:e5c0::4" >> /etc/resolv.conf
|
echo "nameserver 2a0a:e5c0::4" >> /etc/resolv.conf
|
||||||
|
@ -11,16 +24,14 @@ if ! $(which rdnssd); then
|
||||||
apk add ndisc6
|
apk add ndisc6
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get IPv6 DNS
|
# Start rdnssd to get DNS
|
||||||
rdnssd -u root -r /etc/resolv.conf
|
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
|
# Initial Package Intallation
|
||||||
if [ [ $(get_distro) = "alpine" ]; then
|
if [[ $(get_distro) = "alpine" ]]; then
|
||||||
apk update
|
apk update
|
||||||
apk add python3 openssh-server sfdisk util-linux jq
|
apk add openssh-server sfdisk util-linux jq
|
||||||
touch $ssh_authorized_keys_path
|
touch $ssh_authorized_keys_path
|
||||||
|
|
||||||
if ! grep -q "PasswordAuthentication no" $ssh_config_path; then
|
if ! grep -q "PasswordAuthentication no" $ssh_config_path; then
|
||||||
|
|
Loading…
Reference in a new issue