diff --git a/files/bashscripts/debian/debian-change-ip.sh b/files/bashscripts/debian/debian-change-ip.sh deleted file mode 100755 index aa4df5c..0000000 --- a/files/bashscripts/debian/debian-change-ip.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# ask to set static ip address -read -r -p "Set Static IP address? " 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 Primary DNS IP Address: " dnsip1 - # get adapter name - name=$(basename /sys/class/net/e*) - # backup original interfaces file - if [[ ! -f /etc/network/interfaces.bak ]] ; then - cp /etc/network/interfaces /etc/network/interfaces.bak - fi - rm /etc/network/interfaces - cp /etc/network/interfaces.bak /etc/network/interfaces - # set static ip - sed -i "s,^iface $name inet dhcp*,iface $name inet static," /etc/network/interfaces - echo " address $staticip" >> /etc/network/interfaces - echo " gateway $gatewayip" >> /etc/network/interfaces - # backup resolv.conf file - if [[ ! -f /etc/resolv.conf.bak ]] ; then - cp /etc/resolv.conf /etc/resolv.conf.bak - fi - rm /etc/resolv.conf - # set primary dns ip - echo "nameserver $dnsip1" >> /etc/resolv.conf - # ask for secondary dns ip - read -r -p "Set Secondary DNS IP Address? " prompt - if [[ "${prompt,,}" =~ ^(y|yes)$ ]] ; then - read -r -p "Enter Secondary DNS IP Address: " dnsip2 - echo "nameserver $dnsip2" >> /etc/resolv.conf - fi - # restart the interface - ifdown $name - ifup $name -fi diff --git a/files/bashscripts/debian/debian-docker-install.sh b/files/bashscripts/debian/debian-docker-install.sh deleted file mode 100755 index 48f7acc..0000000 --- a/files/bashscripts/debian/debian-docker-install.sh +++ /dev/null @@ -1,22 +0,0 @@ -# ask to install docker -if [[ ! -f /etc/apt/keyrings/docker.gpg ]] ; then - read -r -p "Install Docker? " prompt - if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then - # prepare for install - apt-get update - apt-get install -y ca-certificates curl gnupg lsb-release - mkdir -p /home/akanealw/docker/appdata - chown -R akanealw:akanealw /home/akanealw/docker - mkdir -m 0755 -p /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - # install docker - apt-get update - apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin - # post install - groupadd docker > /dev/null 2>&1 - usermod -aG docker akanealw - systemctl enable docker.service - systemctl enable containerd.service - fi -fi diff --git a/files/bashscripts/debian/debian-essentials.sh b/files/bashscripts/debian/debian-essentials.sh index 1dbb92e..1609e9d 100755 --- a/files/bashscripts/debian/debian-essentials.sh +++ b/files/bashscripts/debian/debian-essentials.sh @@ -143,113 +143,3 @@ if [ $isInFile -eq 0 ] echo "# nfs shares" >> /etc/fstab echo "192.168.1.41:/mnt/data /mnt/truenasdata nfs defaults,nolock,soft,vers=4.2 0 0" >> /etc/fstab fi - -# ask to install samba -if [[ ! -f /etc/samba/smb.conf ]] - then - read -r -p "Install Samba? " prompt - if [[ "${prompt,,}" =~ ^(y|yes)$ ]] - then - apt-get install -y samba --no-install-recommends - (echo "8ung1e1!"; sleep 1; echo "8ung1e1!" ) | smbpasswd -s -a akanealw - sed -i s/WORKGROUP/akanealw/ /etc/samba/smb.conf - isInFile=$(cat /etc/samba/smb.conf | grep -c "akanealw]") - if [ $isInFile -eq 0 ] - then - echo "[akanealw]" >> /etc/samba/smb.conf - echo " comment = akanealw" >> /etc/samba/smb.conf - echo " read only = no" >> /etc/samba/smb.conf - echo " path = /home/akanealw" >> /etc/samba/smb.conf - echo " guest ok = no" >> /etc/samba/smb.conf - echo "" >> /etc/samba/smb.conf - fi - fi -fi - -# ask to install docker -if [[ ! -f /etc/apt/keyrings/docker.gpg ]] - then - read -r -p "Install Docker? " prompt - if [[ "${prompt,,}" =~ ^(y|yes)$ ]] - then - apt-get update - apt-get install -y ca-certificates curl gnupg lsb-release - mkdir -p /home/akanealw/docker/appdata - chown -R akanealw:akanealw /home/akanealw/docker - mkdir -m 0755 -p /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - apt-get update - apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin - groupadd docker > /dev/null 2>&1 - usermod -aG docker akanealw - systemctl enable docker.service - systemctl enable containerd.service - fi -fi - -# ask to regenerate machine-id -if [[ ! -f /etc/machine-id-regenerated ]] - then - read -r -p "Regenerate machine-id? " 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 - -# 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? " 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 - fi -fi - -# ask to set static ip address -if [[ ! -d /etc/cloud ]] - then - if [[ ! -f /etc/network/interfaces.bak ]] - then - read -r -p "Set Static IP address? " 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 Primary DNS IP Address: " dnsip1 - read -r -p "Enter Secondary DNS IP Address: " dnsip2 - name=$(basename /sys/class/net/e*) - if [[ ! -f /etc/network/interfaces.bak ]] - then - cp /etc/network/interfaces /etc/network/interfaces.bak - fi - rm /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 - echo " address $staticip" >> /etc/network/interfaces - echo " gateway $gatewayip" >> /etc/network/interfaces - if [[ ! -f /etc/resolv.conf.bak ]] - then - cp /etc/resolv.conf /etc/resolv.conf.bak - fi - rm /etc/resolv.conf - echo "nameserver $dnsip1" >> /etc/resolv.conf - echo "nameserver $dnsip2" >> /etc/resolv.conf - ifdown $name - ifup $name - fi - fi -fi diff --git a/files/bashscripts/debian/debian-install-docker.sh b/files/bashscripts/debian/debian-install-docker.sh new file mode 100755 index 0000000..790b8a1 --- /dev/null +++ b/files/bashscripts/debian/debian-install-docker.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# ask to install docker +if [[ ! -f /etc/apt/keyrings/docker.gpg ]] + then + read -r -p "Install Docker? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]] + then + apt-get update + apt-get install -y ca-certificates curl gnupg lsb-release + mkdir -p /home/akanealw/docker/appdata + chown -R akanealw:akanealw /home/akanealw/docker + mkdir -m 0755 -p /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update + apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + groupadd docker > /dev/null 2>&1 + usermod -aG docker akanealw + systemctl enable docker.service + systemctl enable containerd.service + fi +fi diff --git a/files/bashscripts/debian/debian-install-samba.sh b/files/bashscripts/debian/debian-install-samba.sh new file mode 100755 index 0000000..cf51580 --- /dev/null +++ b/files/bashscripts/debian/debian-install-samba.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# ask to install samba +if [[ ! -f /etc/samba/smb.conf ]] + then + read -r -p "Install Samba? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]] + then + apt-get install -y samba --no-install-recommends + (echo "8ung1e1!"; sleep 1; echo "8ung1e1!" ) | smbpasswd -s -a akanealw + sed -i s/WORKGROUP/akanealw/ /etc/samba/smb.conf + isInFile=$(cat /etc/samba/smb.conf | grep -c "akanealw]") + if [ $isInFile -eq 0 ] + then + echo "[akanealw]" >> /etc/samba/smb.conf + echo " comment = akanealw" >> /etc/samba/smb.conf + echo " read only = no" >> /etc/samba/smb.conf + echo " path = /home/akanealw" >> /etc/samba/smb.conf + echo " guest ok = no" >> /etc/samba/smb.conf + echo "" >> /etc/samba/smb.conf + fi + fi +fi diff --git a/files/bashscripts/debian/debian-regenerate-ssh-keys-machine-id.sh b/files/bashscripts/debian/debian-regenerate-ssh-keys-machine-id.sh new file mode 100644 index 0000000..2811bd1 --- /dev/null +++ b/files/bashscripts/debian/debian-regenerate-ssh-keys-machine-id.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# ask to regenerate machine-id +if [[ ! -f /etc/machine-id-regenerated ]] + then + read -r -p "Regenerate machine-id? " 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 + +# 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? " 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 + fi +fi diff --git a/files/bashscripts/debian/debian-samba-install.sh b/files/bashscripts/debian/debian-samba-install.sh deleted file mode 100755 index 2ccfa5b..0000000 --- a/files/bashscripts/debian/debian-samba-install.sh +++ /dev/null @@ -1,17 +0,0 @@ -# install and configure default share -apt-get update -apt-get install -y samba --no-install-recommends -(echo "8ung1e1!"; sleep 1; echo "8ung1e1!" ) | smbpasswd -s -a akanealw -sed -i s/WORKGROUP/akanealw/ /etc/samba/smb.conf -isInFile=$(cat /etc/samba/smb.conf | grep -c "akanealw]") -if [ $isInFile -eq 0 ]; then - echo "[akanealw]" >> /etc/samba/smb.conf - echo " comment = akanealw" >> /etc/samba/smb.conf - echo " read only = no" >> /etc/samba/smb.conf - echo " path = /home/akanealw" >> /etc/samba/smb.conf - echo " guest ok = no" >> /etc/samba/smb.conf - echo "" >> /etc/samba/smb.conf -fi - -# restart samba -systemctl restart smbd diff --git a/files/bashscripts/debian/debian-sources-update.sh b/files/bashscripts/debian/debian-sources-update.sh deleted file mode 100644 index c0c0469..0000000 --- a/files/bashscripts/debian/debian-sources-update.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -if [[ -f /etc/apt/sources.list ]] ; then - isInFile=$(cat /etc/apt/sources.list | grep -c "bullseye") - if [ $isInFile -eq 0 ]; then - mkdir /etc/apt/mirrors > /dev/null 2>&1 - echo "https://deb.debian.org/debian" >> /etc/apt/mirrors/debian.list - echo "https://deb.debian.org/debian-security" >> /etc/apt/mirrors/debian-security.list - echo "Types: deb deb-src" >> /etc/apt/sources.list.d/debian.sources - echo "URIs: mirror+file:///etc/apt/mirrors/debian.list" >> /etc/apt/sources.list.d/debian.sources - echo "Suites: bookworm bookworm-updates bookworm-backports" >> /etc/apt/sources.list.d/debian.sources - echo "Components: main contrib non-free non-free-firmware" >> /etc/apt/sources.list.d/debian.sources - echo "" >> /etc/apt/sources.list.d/debian.sources - echo "Types: deb deb-src" >> /etc/apt/sources.list.d/debian.sources - echo "URIs: mirror+file:///etc/apt/mirrors/debian-security.list" >> /etc/apt/sources.list.d/debian.sources - echo "Suites: bookworm-security" >> /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 - rm /etc/apt/sources.list.11.backup > /dev/null 2>&1 - fi -fi diff --git a/files/bashscripts/debian/debian-static-ip.sh b/files/bashscripts/debian/debian-static-ip.sh new file mode 100755 index 0000000..0dc921b --- /dev/null +++ b/files/bashscripts/debian/debian-static-ip.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# ask to set static ip address +if [[ ! -d /etc/cloud ]] + then + if [[ ! -f /etc/network/interfaces.bak ]] + then + read -r -p "Set Static IP address? " 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 Primary DNS IP Address: " dnsip1 + read -r -p "Enter Secondary DNS IP Address: " dnsip2 + name=$(basename /sys/class/net/e*) + if [[ ! -f /etc/network/interfaces.bak ]] + then + cp /etc/network/interfaces /etc/network/interfaces.bak + fi + rm /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 + echo " address $staticip" >> /etc/network/interfaces + echo " gateway $gatewayip" >> /etc/network/interfaces + if [[ ! -f /etc/resolv.conf.bak ]] + then + cp /etc/resolv.conf /etc/resolv.conf.bak + fi + rm /etc/resolv.conf + echo "nameserver $dnsip1" >> /etc/resolv.conf + echo "nameserver $dnsip2" >> /etc/resolv.conf + ifdown $name + ifup $name + fi + fi +fi \ No newline at end of file diff --git a/files/bashscripts/debian/debian-update-sources.sh b/files/bashscripts/debian/debian-update-sources.sh new file mode 100644 index 0000000..eace5d6 --- /dev/null +++ b/files/bashscripts/debian/debian-update-sources.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# update bookworm to new debian.sources file +if [[ -f /etc/apt/sources.list.d/debian.sources ]] + then + echo "Sources already updated" + else + isInFile=$(cat /etc/apt/sources.list | grep -c "bullseye") + if [ $isInFile -eq 0 ] + then + mkdir /etc/apt/mirrors > /dev/null 2>&1 + echo "https://deb.debian.org/debian" >> /etc/apt/mirrors/debian.list + echo "https://deb.debian.org/debian-security" >> /etc/apt/mirrors/debian-security.list + echo "Types: deb deb-src" >> /etc/apt/sources.list.d/debian.sources + echo "URIs: mirror+file:///etc/apt/mirrors/debian.list" >> /etc/apt/sources.list.d/debian.sources + echo "Suites: bookworm bookworm-updates bookworm-backports" >> /etc/apt/sources.list.d/debian.sources + echo "Components: main contrib non-free non-free-firmware" >> /etc/apt/sources.list.d/debian.sources + echo "" >> /etc/apt/sources.list.d/debian.sources + echo "Types: deb deb-src" >> /etc/apt/sources.list.d/debian.sources + echo "URIs: mirror+file:///etc/apt/mirrors/debian-security.list" >> /etc/apt/sources.list.d/debian.sources + echo "Suites: bookworm-security" >> /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 + rm /etc/apt/sources.list.11.backup > /dev/null 2>&1 + else + echo "Bullseye detected, skipping sources update" + fi +fi diff --git a/files/bashscripts/proxyserver/root/crontab.bak b/files/bashscripts/proxyserver/root/crontab.bak index 4f0bc1e..e6e9bd3 100644 --- a/files/bashscripts/proxyserver/root/crontab.bak +++ b/files/bashscripts/proxyserver/root/crontab.bak @@ -21,4 +21,4 @@ # For more information see the manual pages of crontab(5) and cron(8) # # m h dom mon dow command -0 15 * * * /root/scripts/clean-plex-photo-cache.sh +#0 15 * * * /root/scripts/clean-plex-photo-cache.sh