diff --git a/alpine/alpine-adduser-sudo.sh b/alpine/alpine-adduser-sudo.sh index 6dcea33..8091801 100644 --- a/alpine/alpine-adduser-sudo.sh +++ b/alpine/alpine-adduser-sudo.sh @@ -2,5 +2,4 @@ apk update apk add sudo -echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel -adduser akanealw wheel +echo '%akanealw ALL=(ALL) ALL' > /etc/sudoers.d/akanealw diff --git a/alpine/alpine-aliases.sh b/alpine/alpine-aliases.sh deleted file mode 100644 index b0504be..0000000 --- a/alpine/alpine-aliases.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -echo "# custom settings and aliases" > ~/.profile -echo "" >> ~/.profile -echo "alias lsa='ls -alhvF'" >> ~/.profile -echo "alias cd..='cd ..'" >> ~/.profile -echo "alias ..='cd ..'" >> ~/.profile -echo "alias ...='cd ../..'" >> ~/.profile -echo "alias grep='grep --color'" >> ~/.profile -echo "alias mkdir='mkdir -pv'" >> ~/.profile -echo "alias du='du -h'" >> ~/.profile -echo "alias df='df -h'" >> ~/.profile -echo "alias ports='netstat -tulpna'" >> ~/.profile -echo "alias tf='tail -f'" >> ~/.profile -echo "alias dc='docker compose'" >> ~/.profile -echo "alias dcup='docker compose up -d'" >> ~/.profile -echo "alias dcdown='docker compose down'" >> ~/.profile -echo "alias dcpull='docker compose pull'" >> ~/.profile -echo "alias dps='docker ps'" >> ~/.profile -echo "alias dstart='docker start'" >> ~/.profile -echo "alias dstop='docker stop'" >> ~/.profile -echo "alias drestart='docker restart'" >> ~/.profile -echo "alias dlf='docker logs -f'" >> ~/.profile -echo "alias dipaf='docker image prune -a -f'" >> ~/.profile diff --git a/alpine/alpine-essentials.sh b/alpine/alpine-essentials.sh index 683cd1e..1d7aaf0 100644 --- a/alpine/alpine-essentials.sh +++ b/alpine/alpine-essentials.sh @@ -1,8 +1,24 @@ #!/bin/ash +if [ "$EUID" -ne 0 ] + then + echo "Please run as root" + exit +fi + # apk update and install essentials apk update && apk upgrade -apk add nano -nano /etc/apk/repositories +apk add nano sudo pwgen curl wget qemu-guest-agent git bash-doc bash-completion --no-cache -apk add curl wget qemu-guest-agent git bash-doc bash-completion --no-cache +# change default shell to bash +isInFile=$(cat /etc/passwd | grep -c "/bin/bash") +if [ $isInFile -eq 0 ] + then + sed -i 's/ash/bash/g' /etc/passwd +fi + +# add akanealw to sudo users +if [[ ! -f /etc/sudoers.d/akanealw ]] + then + echo "akanealw ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/akanealw +fi diff --git a/alpine/alpine-install-docker.sh b/alpine/alpine-install-docker.sh index a83db68..1848852 100644 --- a/alpine/alpine-install-docker.sh +++ b/alpine/alpine-install-docker.sh @@ -1,5 +1,6 @@ #!/bin/ash +apk update && apk upgrade apk add docker docker-cli-compose addgroup akanealw docker diff --git a/alpine/alpine-user-customizations.sh b/alpine/alpine-user-customizations.sh new file mode 100644 index 0000000..462d0f4 --- /dev/null +++ b/alpine/alpine-user-customizations.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# add aliases +echo "# custom settings and aliases" > ~/.bash_profile +echo "" >> ~/.bash_profile +echo "alias lsa='ls -alhvF'" >> ~/.bash_profile +echo "alias cd..='cd ..'" >> ~/.bash_profile +echo "alias ..='cd ..'" >> ~/.bash_profile +echo "alias ...='cd ../..'" >> ~/.bash_profile +echo "alias grep='grep --color'" >> ~/.bash_profile +echo "alias mkdir='mkdir -pv'" >> ~/.bash_profile +echo "alias du='du -h'" >> ~/.bash_profile +echo "alias df='df -h'" >> ~/.bash_profile +echo "alias ports='netstat -tulpna'" >> ~/.bash_profile +echo "alias tf='tail -f'" >> ~/.bash_profile +echo "alias dc='docker compose'" >> ~/.bash_profile +echo "alias dcup='docker compose up -d'" >> ~/.bash_profile +echo "alias dcdown='docker compose down'" >> ~/.bash_profile +echo "alias dcpull='docker compose pull'" >> ~/.bash_profile +echo "alias dps='docker ps'" >> ~/.bash_profile +echo "alias dstart='docker start'" >> ~/.bash_profile +echo "alias dstop='docker stop'" >> ~/.bash_profile +echo "alias drestart='docker restart'" >> ~/.bash_profile +echo "alias dlf='docker logs -f'" >> ~/.bash_profile +echo "alias dipaf='docker image prune -a -f'" >> ~/.bash_profile + +# git config +git config --global credential.helper store +git config --global user.name "akanealw" +git config --global user.email "akanealw@gmail.com" +git config --global init.defaultBranch main + diff --git a/alpine/download-alpine-scripts.sh b/alpine/download-alpine-scripts.sh index 6410ee0..96c35e5 100644 --- a/alpine/download-alpine-scripts.sh +++ b/alpine/download-alpine-scripts.sh @@ -1,11 +1,10 @@ #!/bin/ash -wget http://192.168.1.50/scripts/alpine/alpine-adduser-sudo.sh -wget http://192.168.1.50/scripts/alpine/alpine-aliases.sh -wget http://192.168.1.50/scripts/alpine/alpine-configure-git.sh wget http://192.168.1.50/scripts/alpine/alpine-essentials.sh wget http://192.168.1.50/scripts/alpine/alpine-install-docker.sh +wget http://192.168.1.50/scripts/alpine/alpine-user-customizations.sh -mkdir ~/scripts +mkdir ~/scripts > /dev/null 2>&1 +rm ~/scripts/alpine-* > /dev/null 2>&1 mv alpine-* scripts/ chmod +x ~/scripts/*