updated scripts

This commit is contained in:
2023-08-27 11:37:12 -05:00
parent e1bf51a674
commit ae3a85434d
10 changed files with 83 additions and 82 deletions

View File

@@ -18,6 +18,7 @@ if [[ ! -f /etc/apt/keyrings/docker.gpg ]]
systemctl start containerd.service
systemctl status docker.service
systemctl status containerd.service
echo "Docker installed successfully."
else
echo "Docker is already configured."
fi

View File

@@ -14,6 +14,7 @@ if [ $isInFile -eq 0 ]
echo "" >> /etc/samba/smb.conf
systemctl restart smbd
systemctl status smbd
echo "Samba configured successfully."
else
echo "Samba is already configured."
fi

View File

@@ -3,30 +3,28 @@
# ask to regenerate machine-id
if [[ ! -f /etc/machine-id-regenerated ]]
then
read -r -p "Regenerate machine-id? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]
then
rm -f /etc/machine-id /var/lib/dbus/machine-id
dbus-uuidgen --ensure=/etc/machine-id
dbus-uuidgen --ensure
touch /etc/machine-id-regenerated
fi
fi
rm -f /etc/machine-id /var/lib/dbus/machine-id
dbus-uuidgen --ensure=/etc/machine-id
dbus-uuidgen --ensure
touch /etc/machine-id-regenerated
echo "Machine-id regenerated successfully."
else
echo "Machine-id not regenerated."
fi
# ask to regenerate ssh host keys
if [[ ! -d /etc/cloud ]]
then
if [[ ! -f /home/akanealw/.ssh/ssh_keys_regenerated ]]
then
read -r -p "Regenerate SSH Keys? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]
then
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
mkdir /home/akanealw/.ssh
touch /home/akanealw/.ssh/ssh_keys_regenerated
chmod 700 /home/akanealw/.ssh
chown -R akanealw:akanealw /home/akanealw/.ssh
fi
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
mkdir /home/akanealw/.ssh
touch /home/akanealw/.ssh/ssh_keys_regenerated
chmod 700 /home/akanealw/.ssh
chown -R akanealw:akanealw /home/akanealw/.ssh
echo "SSH host keys regenerated successfully."
else
echo "SSH host keys not regenerated."
fi
fi

View File

@@ -1,16 +1,17 @@
# ask to set static ip address
read -r -p "Set Static IP address? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]] ; then
read -r -p "Enter Static IP Address with subnet prefix: " staticip
read -r -p "Enter Gateway IP Address: " gatewayip
read -r -p "Enter DNS IP Address (separated by commas): " dnsip
# get adapter name
name=$(basename /sys/class/net/e*)
# backup original netplan yaml file
mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak > /dev/null 2>&1
rm /etc/netplan/01-network-manager-all.yaml > /dev/null 2>&1
# create new netplan yaml file
cat >> /etc/netplan/01-network-manager-all.yaml <<HERE
if [[ ! -d /etc/cloud ]]
then
read -r -p "Enter Static IP Address with subnet prefix: " staticip
read -r -p "Enter Gateway IP Address: " gatewayip
read -r -p "Enter DNS IP Address (separated by commas): " dnsip
# get adapter name
name=$(basename /sys/class/net/e*)
# backup original netplan yaml file
mv /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak > /dev/null 2>&1
rm /etc/netplan/01-network-manager-all.yaml > /dev/null 2>&1
# create new netplan yaml file
cat >> /etc/netplan/01-network-manager-all.yaml <<HERE
network:
version: 2
renderer: networkd
@@ -22,8 +23,11 @@ network:
addresses: [$dnsip]
routes:
- to: default
via: $gatewayip
via: $gatewayip
HERE
# apply netplan
sudo netplan apply
# apply netplan
sudo netplan apply
echo "Static IP set successfully."
else
echo "Static IP not set."
fi