updated scripts
This commit is contained in:
1
debian/debian-install-docker.sh
vendored
1
debian/debian-install-docker.sh
vendored
@@ -18,6 +18,7 @@ if [[ ! -f /etc/apt/keyrings/docker.gpg ]]
|
|||||||
systemctl start containerd.service
|
systemctl start containerd.service
|
||||||
systemctl status docker.service
|
systemctl status docker.service
|
||||||
systemctl status containerd.service
|
systemctl status containerd.service
|
||||||
|
echo "Docker installed successfully."
|
||||||
else
|
else
|
||||||
echo "Docker is already configured."
|
echo "Docker is already configured."
|
||||||
fi
|
fi
|
||||||
|
|||||||
1
debian/debian-install-samba.sh
vendored
1
debian/debian-install-samba.sh
vendored
@@ -14,6 +14,7 @@ if [ $isInFile -eq 0 ]
|
|||||||
echo "" >> /etc/samba/smb.conf
|
echo "" >> /etc/samba/smb.conf
|
||||||
systemctl restart smbd
|
systemctl restart smbd
|
||||||
systemctl status smbd
|
systemctl status smbd
|
||||||
|
echo "Samba configured successfully."
|
||||||
else
|
else
|
||||||
echo "Samba is already configured."
|
echo "Samba is already configured."
|
||||||
fi
|
fi
|
||||||
|
|||||||
14
debian/debian-regenerate-ssh-keys-machine-id.sh
vendored
14
debian/debian-regenerate-ssh-keys-machine-id.sh
vendored
@@ -2,24 +2,20 @@
|
|||||||
|
|
||||||
# ask to regenerate machine-id
|
# ask to regenerate machine-id
|
||||||
if [[ ! -f /etc/machine-id-regenerated ]]
|
if [[ ! -f /etc/machine-id-regenerated ]]
|
||||||
then
|
|
||||||
read -r -p "Regenerate machine-id? <y/N> " prompt
|
|
||||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]
|
|
||||||
then
|
then
|
||||||
rm -f /etc/machine-id /var/lib/dbus/machine-id
|
rm -f /etc/machine-id /var/lib/dbus/machine-id
|
||||||
dbus-uuidgen --ensure=/etc/machine-id
|
dbus-uuidgen --ensure=/etc/machine-id
|
||||||
dbus-uuidgen --ensure
|
dbus-uuidgen --ensure
|
||||||
touch /etc/machine-id-regenerated
|
touch /etc/machine-id-regenerated
|
||||||
fi
|
echo "Machine-id regenerated successfully."
|
||||||
|
else
|
||||||
|
echo "Machine-id not regenerated."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ask to regenerate ssh host keys
|
# ask to regenerate ssh host keys
|
||||||
if [[ ! -d /etc/cloud ]]
|
if [[ ! -d /etc/cloud ]]
|
||||||
then
|
then
|
||||||
if [[ ! -f /home/akanealw/.ssh/ssh_keys_regenerated ]]
|
if [[ ! -f /home/akanealw/.ssh/ssh_keys_regenerated ]]
|
||||||
then
|
|
||||||
read -r -p "Regenerate SSH Keys? <y/N> " prompt
|
|
||||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]
|
|
||||||
then
|
then
|
||||||
rm /etc/ssh/ssh_host_*
|
rm /etc/ssh/ssh_host_*
|
||||||
dpkg-reconfigure openssh-server
|
dpkg-reconfigure openssh-server
|
||||||
@@ -27,6 +23,8 @@ if [[ ! -d /etc/cloud ]]
|
|||||||
touch /home/akanealw/.ssh/ssh_keys_regenerated
|
touch /home/akanealw/.ssh/ssh_keys_regenerated
|
||||||
chmod 700 /home/akanealw/.ssh
|
chmod 700 /home/akanealw/.ssh
|
||||||
chown -R akanealw:akanealw /home/akanealw/.ssh
|
chown -R akanealw:akanealw /home/akanealw/.ssh
|
||||||
fi
|
echo "SSH host keys regenerated successfully."
|
||||||
|
else
|
||||||
|
echo "SSH host keys not regenerated."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
17
debian/debian-set-ip.sh
vendored
17
debian/debian-set-ip.sh
vendored
@@ -5,32 +5,27 @@ if [[ ! -d /etc/cloud ]]
|
|||||||
then
|
then
|
||||||
if [[ ! -f /etc/network/interfaces.bak ]]
|
if [[ ! -f /etc/network/interfaces.bak ]]
|
||||||
then
|
then
|
||||||
read -r -p "Set Static IP address? <y/N> " prompt
|
read -r -p "Enter Static IP Address with subnet mask: " staticip
|
||||||
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 Gateway IP Address: " gatewayip
|
||||||
read -r -p "Enter Primary DNS IP Address: " dnsip1
|
read -r -p "Enter Primary DNS IP Address: " dnsip1
|
||||||
read -r -p "Enter Secondary DNS IP Address: " dnsip2
|
read -r -p "Enter Secondary DNS IP Address: " dnsip2
|
||||||
name=$(basename /sys/class/net/e*)
|
name=$(basename /sys/class/net/e*)
|
||||||
if [[ ! -f /etc/network/interfaces.bak ]]
|
|
||||||
then
|
|
||||||
cp /etc/network/interfaces /etc/network/interfaces.bak
|
cp /etc/network/interfaces /etc/network/interfaces.bak
|
||||||
fi
|
|
||||||
rm /etc/network/interfaces
|
rm /etc/network/interfaces
|
||||||
cp /etc/network/interfaces.bak /etc/network/interfaces
|
cp /etc/network/interfaces.bak /etc/network/interfaces
|
||||||
sed -i "s,^iface $name inet dhcp*,iface $name inet static," /etc/network/interfaces
|
sed -i "s,^iface $name inet dhcp*,iface $name inet static," /etc/network/interfaces
|
||||||
echo " address $staticip" >> /etc/network/interfaces
|
echo " address $staticip" >> /etc/network/interfaces
|
||||||
echo " gateway $gatewayip" >> /etc/network/interfaces
|
echo " gateway $gatewayip" >> /etc/network/interfaces
|
||||||
if [[ ! -f /etc/resolv.conf.bak ]]
|
|
||||||
then
|
|
||||||
cp /etc/resolv.conf /etc/resolv.conf.bak
|
cp /etc/resolv.conf /etc/resolv.conf.bak
|
||||||
fi
|
|
||||||
rm /etc/resolv.conf
|
rm /etc/resolv.conf
|
||||||
echo "nameserver $dnsip1" >> /etc/resolv.conf
|
echo "nameserver $dnsip1" >> /etc/resolv.conf
|
||||||
echo "nameserver $dnsip2" >> /etc/resolv.conf
|
echo "nameserver $dnsip2" >> /etc/resolv.conf
|
||||||
ifdown $name
|
ifdown $name
|
||||||
ifup $name
|
ifup $name
|
||||||
|
echo "Static IP set successfully."
|
||||||
|
else
|
||||||
|
echo "Static IP not set."
|
||||||
fi
|
fi
|
||||||
fi
|
else
|
||||||
|
echo "Static IP not set."
|
||||||
fi
|
fi
|
||||||
1
debian/debian-setup-unattended-upgrades.sh
vendored
1
debian/debian-setup-unattended-upgrades.sh
vendored
@@ -13,6 +13,7 @@ if [ $isInFile -eq 0 ]
|
|||||||
systemctl enable unattended-upgrades
|
systemctl enable unattended-upgrades
|
||||||
systemctl start unattended-upgrades
|
systemctl start unattended-upgrades
|
||||||
systemctl status unattended-upgrades
|
systemctl status unattended-upgrades
|
||||||
|
echo "Unattended upgrades configured successfully."
|
||||||
else
|
else
|
||||||
echo "Unattended upgrades already configured."
|
echo "Unattended upgrades already configured."
|
||||||
fi
|
fi
|
||||||
|
|||||||
5
debian/debian-update-sources.sh
vendored
5
debian/debian-update-sources.sh
vendored
@@ -3,7 +3,7 @@
|
|||||||
# update bookworm to new debian.sources file
|
# update bookworm to new debian.sources file
|
||||||
if [[ -f /etc/apt/sources.list.d/debian.sources ]]
|
if [[ -f /etc/apt/sources.list.d/debian.sources ]]
|
||||||
then
|
then
|
||||||
echo "Sources already updated"
|
echo "Sources already updated."
|
||||||
else
|
else
|
||||||
isInFile=$(cat /etc/apt/sources.list | grep -c "bullseye")
|
isInFile=$(cat /etc/apt/sources.list | grep -c "bullseye")
|
||||||
if [ $isInFile -eq 0 ]
|
if [ $isInFile -eq 0 ]
|
||||||
@@ -22,7 +22,8 @@ if [[ -f /etc/apt/sources.list.d/debian.sources ]]
|
|||||||
echo "Components: main" >> /etc/apt/sources.list.d/debian.sources
|
echo "Components: main" >> /etc/apt/sources.list.d/debian.sources
|
||||||
mv /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1
|
mv /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>&1
|
||||||
rm /etc/apt/sources.list.11.backup > /dev/null 2>&1
|
rm /etc/apt/sources.list.11.backup > /dev/null 2>&1
|
||||||
|
echo "Bookworm sources updated successfully."
|
||||||
else
|
else
|
||||||
echo "Bullseye detected, skipping sources update"
|
echo "Bullseye detected, skipping sources update."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ if [[ ! -f /etc/apt/keyrings/docker.gpg ]]
|
|||||||
systemctl start containerd.service
|
systemctl start containerd.service
|
||||||
systemctl status docker.service
|
systemctl status docker.service
|
||||||
systemctl status containerd.service
|
systemctl status containerd.service
|
||||||
|
echo "Docker installed successfully."
|
||||||
else
|
else
|
||||||
echo "Docker is already configured."
|
echo "Docker is already configured."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ if [ $isInFile -eq 0 ]
|
|||||||
echo "" >> /etc/samba/smb.conf
|
echo "" >> /etc/samba/smb.conf
|
||||||
systemctl restart smbd
|
systemctl restart smbd
|
||||||
systemctl status smbd
|
systemctl status smbd
|
||||||
|
echo "Samba configured successfully."
|
||||||
else
|
else
|
||||||
echo "Samba is already configured."
|
echo "Samba is already configured."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,24 +2,20 @@
|
|||||||
|
|
||||||
# ask to regenerate machine-id
|
# ask to regenerate machine-id
|
||||||
if [[ ! -f /etc/machine-id-regenerated ]]
|
if [[ ! -f /etc/machine-id-regenerated ]]
|
||||||
then
|
|
||||||
read -r -p "Regenerate machine-id? <y/N> " prompt
|
|
||||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]
|
|
||||||
then
|
then
|
||||||
rm -f /etc/machine-id /var/lib/dbus/machine-id
|
rm -f /etc/machine-id /var/lib/dbus/machine-id
|
||||||
dbus-uuidgen --ensure=/etc/machine-id
|
dbus-uuidgen --ensure=/etc/machine-id
|
||||||
dbus-uuidgen --ensure
|
dbus-uuidgen --ensure
|
||||||
touch /etc/machine-id-regenerated
|
touch /etc/machine-id-regenerated
|
||||||
fi
|
echo "Machine-id regenerated successfully."
|
||||||
|
else
|
||||||
|
echo "Machine-id not regenerated."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ask to regenerate ssh host keys
|
# ask to regenerate ssh host keys
|
||||||
if [[ ! -d /etc/cloud ]]
|
if [[ ! -d /etc/cloud ]]
|
||||||
then
|
then
|
||||||
if [[ ! -f /home/akanealw/.ssh/ssh_keys_regenerated ]]
|
if [[ ! -f /home/akanealw/.ssh/ssh_keys_regenerated ]]
|
||||||
then
|
|
||||||
read -r -p "Regenerate SSH Keys? <y/N> " prompt
|
|
||||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]
|
|
||||||
then
|
then
|
||||||
rm /etc/ssh/ssh_host_*
|
rm /etc/ssh/ssh_host_*
|
||||||
dpkg-reconfigure openssh-server
|
dpkg-reconfigure openssh-server
|
||||||
@@ -27,6 +23,8 @@ if [[ ! -d /etc/cloud ]]
|
|||||||
touch /home/akanealw/.ssh/ssh_keys_regenerated
|
touch /home/akanealw/.ssh/ssh_keys_regenerated
|
||||||
chmod 700 /home/akanealw/.ssh
|
chmod 700 /home/akanealw/.ssh
|
||||||
chown -R akanealw:akanealw /home/akanealw/.ssh
|
chown -R akanealw:akanealw /home/akanealw/.ssh
|
||||||
fi
|
echo "SSH host keys regenerated successfully."
|
||||||
|
else
|
||||||
|
echo "SSH host keys not regenerated."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# ask to set static ip address
|
# ask to set static ip address
|
||||||
read -r -p "Set Static IP address? <y/N> " prompt
|
|
||||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]] ; then
|
if [[ ! -d /etc/cloud ]]
|
||||||
|
then
|
||||||
read -r -p "Enter Static IP Address with subnet prefix: " staticip
|
read -r -p "Enter Static IP Address with subnet prefix: " staticip
|
||||||
read -r -p "Enter Gateway IP Address: " gatewayip
|
read -r -p "Enter Gateway IP Address: " gatewayip
|
||||||
read -r -p "Enter DNS IP Address (separated by commas): " dnsip
|
read -r -p "Enter DNS IP Address (separated by commas): " dnsip
|
||||||
@@ -26,4 +27,7 @@ network:
|
|||||||
HERE
|
HERE
|
||||||
# apply netplan
|
# apply netplan
|
||||||
sudo netplan apply
|
sudo netplan apply
|
||||||
|
echo "Static IP set successfully."
|
||||||
|
else
|
||||||
|
echo "Static IP not set."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user