#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: http://mirrors.slickstack.io/bash/ss-install-ubuntu-bash.txt ########################## #### path: /var/www/ss-install-ubuntu-bash ######################################################### #### destination: n/a (not a boilerplate) ########################################################## #### purpose: Reinstalls the Ubuntu (OS) bash commands for SlickStack servers (idempotent) ######### #### module version: Ubuntu 20.04 LTS ############################################################## #### sourced by: ss-install ######################################################################## #### bash aliases: ss install ubuntu bash, ss install [bash] aliases, ss install bash ############## #################################################################################################### ## SS-CONFIG MUST BE PROPERLY CONFIGURED AND ON CURRENT BUILD BEFORE RUNNING SS-INSTALL ## ## ENSURE YOUR SS-CONFIG BUILD REMAINS CURRENT BY RUNNING SS-UPDATE OCCASIONALLY ## ## include SlickStack configuration ## source /var/www/ss-config ## include SlickStack functions ## source /var/www/ss-functions #################################################################################################### #### SS-Install-Ubuntu-Bash: Message (Begin Script) ################################################ #################################################################################################### ## this is a simple message that announces to the shell the purpose of this bash script ## ## it will only be noticed by sudo users who manually call ss core bash scripts ## ## echo message ## echo -e "${PURPLE}Running ss-install-ubuntu-bash: Reinstalls the Ubuntu (OS) bash commands for SlickStack servers (idempotent)... ${NOCOLOR}" sleep "$SLEEP_MESSAGE_BEGIN" #################################################################################################### #### SS-Install-Ubuntu-Bash: Cleanup Temporary Files ############################################### #################################################################################################### ## delete tmp files ## rm /tmp/bash-aliases* #################################################################################################### ### SS-Install-Ubuntu-Bash: Install Bash Aliases (SlickStack) ###################################### #################################################################################################### ## delete ## rm /var/www/meta/.bash-aliases rm /var/www/meta/.bashrc_slickstack ## uninstall (root user) ## sed -i '/include Bash aliases/d' "$PATH_ROOT_BASHRC" sed -i '\:var/www/meta:d' "$PATH_ROOT_BASHRC" ## uninstall (sudo user) ## sed -i '/include Bash aliases/d' "$PATH_SUDO_BASHRC" sed -i '\:var/www/meta:d' "$PATH_SUDO_BASHRC" ## retrieve latest files ## wget -O /tmp/bash-aliases.txt "$MIRROR_BASH_ALIASES" ## copy files ## cp /tmp/bash-aliases.txt /var/www/meta/.bash-aliases ## modify .bashrc file (root user) ## echo ' ## include Bash aliases ## source /var/www/meta/.bash-aliases' >> "$PATH_ROOT_BASHRC" ## modify .bashrc file (sudo user) ## echo ' ## include Bash aliases ## source /var/www/meta/.bash-aliases' >> "$PATH_SUDO_BASHRC" #################################################################################################### #### SS-Install-Ubuntu-Bash: Reset Permissions (Ubuntu Bash) ####################################### #################################################################################################### ## run ss-perms-ubuntu-bash ## source "$PATH_SS_PERMS_UBUNTU_BASH" #################################################################################################### #### SS-Install-Ubuntu-Bash: Restart Modules (Ubuntu Bash) ######################################### #################################################################################################### ## reload .bashrc settings ## source "$PATH_ROOT_BASHRC" source "$PATH_SUDO_BASHRC" # source /var/www/ss-restart-services-ubuntu-bash #################################################################################################### #### SS-Install-Ubuntu-Bash: Cleanup Temporary Files ############################################### #################################################################################################### ## delete tmp files ## rm /tmp/bash-aliases* #################################################################################################### #### SS-Install-Ubuntu-Bash: Touch Timestamp File (End Script) ##################################### #################################################################################################### ## this is a dummy timestamp file that will remember the last time this script was run ## ## it can be useful for developer reference and is sometimes used by SlickStack ## ## script timestamp ## touch "$TIMESTAMP_SS_INSTALL_UBUNTU_BASH" #################################################################################################### #### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ############### #################################################################################################### ## Ref: https://stackoverflow.com/questions/2518127/how-do-i-reload-bashrc-without-logging-out-and-back-in ## Ref: https://askubuntu.com/questions/1095779/how-to-reload-bashrc-in-the-shell-calling-a-script ## SS_EOF