diff --git a/files/bashscripts/debian/debian-install-docker.sh b/files/bashscripts/debian/debian-install-docker.sh index fb3617b..c3339bf 100755 --- a/files/bashscripts/debian/debian-install-docker.sh +++ b/files/bashscripts/debian/debian-install-docker.sh @@ -1,26 +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 - 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 - systemctl start docker.service - systemctl start containerd.service - systemctl status docker.service - systemctl status containerd.service - fi + apt-get update + apt-get install -y ca-certificates curl gnupg lsb-release + 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 + systemctl start docker.service + systemctl start containerd.service + systemctl status docker.service + systemctl status containerd.service + else + echo "Docker is already configured." fi diff --git a/files/bashscripts/debian/debian-install-samba.sh b/files/bashscripts/debian/debian-install-samba.sh index e79f38b..3f64bd0 100755 --- a/files/bashscripts/debian/debian-install-samba.sh +++ b/files/bashscripts/debian/debian-install-samba.sh @@ -1,26 +1,19 @@ #!/bin/bash -# ask to install samba -if [[ ! -f /etc/samba/smb.conf ]] +isInFile=$(cat /etc/samba/smb.conf | grep -c "akanealw") +if [ $isInFile -eq 0 ] 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 - -systemctl restart smbd -systemctl status smbd + 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 + 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 + systemctl restart smbd + systemctl status smbd + else + echo "Samba is already configured." + fi diff --git a/files/bashscripts/ubuntu/ubuntu-install-docker.sh b/files/bashscripts/ubuntu/ubuntu-install-docker.sh index 70d412b..1eb346a 100755 --- a/files/bashscripts/ubuntu/ubuntu-install-docker.sh +++ b/files/bashscripts/ubuntu/ubuntu-install-docker.sh @@ -1,20 +1,15 @@ #!/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 - # prepare for install +if [[ ! -f /etc/apt/keyrings/docker.gpg ]] + then apt-get update apt-get install -y ca-certificates curl gnupg lsb-release chown -R akanealw:akanealw /home/akanealw/docker mkdir -m 0755 -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/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/ubuntu $(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 @@ -23,5 +18,6 @@ if [[ ! -f /etc/apt/keyrings/docker.gpg ]] ; then systemctl start containerd.service systemctl status docker.service systemctl status containerd.service - fi + else + echo "Docker is already configured." fi diff --git a/files/bashscripts/ubuntu/ubuntu-install-samba.sh b/files/bashscripts/ubuntu/ubuntu-install-samba.sh index 49bca10..873ae84 100755 --- a/files/bashscripts/ubuntu/ubuntu-install-samba.sh +++ b/files/bashscripts/ubuntu/ubuntu-install-samba.sh @@ -1,24 +1,19 @@ #!/bin/bash -# ask to install samba -if [[ ! -f /etc/samba/smb.conf ]] ; then - read -r -p "Install Samba? " prompt - if [[ "${prompt,,}" =~ ^(y|yes)$ ]] ; then +isInFile=$(cat /etc/samba/smb.conf | grep -c "akanealw") +if [ $isInFile -eq 0 ] + then apt-get install -y samba --no-install-recommends - # configure default samba share (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 + 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 + systemctl restart smbd + systemctl status smbd + else + echo "Samba is already configured." fi - -systemctl restart smbd -systemctl status smbd