#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: https://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 22.04 LTS ############################################################## #### sourced by: ss-install ######################################################################## #### bash aliases: ss install aliases, ss install bash, ss install ubuntu 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 ## ## source ss-config ## source /var/www/ss-config ## source ss-functions ## source /var/www/ss-functions ## BELOW THIS RELIES ON SS-CONFIG AND SS-FUNCTIONS #################################################################################################### #### TABLE OF CONTENTS (SS-Install-Ubuntu-Bash) #################################################### #################################################################################################### ## this is a brief summary of the different code snippets you will find in this script ## ## each section should be commented so you understand what is being accomplished ## ## A. Touch Timestamp File ## B. Message (Begin Script) #################################################################################################### #### A. SS-Install-Ubuntu-Bash: Touch Timestamp File ############################################### #################################################################################################### ## 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 ## ss_touch "${TIMESTAMP_SS_INSTALL_UBUNTU_BASH}" #################################################################################################### #### B. 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 seen by sudo users who manually run this script in the shell ## ss_echo "${COLOR_INFO}Running ss-install-ubuntu-bash... ${COLOR_RESET}" #################################################################################################### ### SS-Install-Ubuntu-Bash: Cleanup ###################################### #################################################################################################### ## delete ## ss_rm /var/www/meta/.bash-aliases ss_rm /var/www/meta/.bashrc_slickstack ss_rm "${PATH_BASHRC}" ## uninstall (root user) ## ss_sed '/include Bash aliases/d' "${PATH_ROOT_BASHRC}" ss_sed '\:var/www/meta:d' "${PATH_ROOT_BASHRC}" ## uninstall (sudo user) ## ss_sed '/include Bash aliases/d' "${PATH_SUDO_BASHRC}" ss_sed '\:var/www/meta:d' "${PATH_SUDO_BASHRC}" #################################################################################################### ### SS-Install-Ubuntu-Bash: Install Bash Aliases (SlickStack) ###################################### #################################################################################################### ## retrieve latest files ## ss_wget "${TMP_BASHRC}" "${GITHUB_BASHRC}" ## copy files ## ss_cp "${TMP_BASHRC}" "${PATH_BASHRC}" ## modify .bashrc file (root user) ## echo ' ## include Bash aliases ## source /var/www/meta/.bashrc' >> "${PATH_ROOT_BASHRC}" ## modify .bashrc file (sudo user) ## echo ' ## include Bash aliases ## source /var/www/meta/.bashrc' >> "${PATH_SUDO_BASHRC}" #################################################################################################### #### SS-Install-Ubuntu-Bash: Reset Permissions (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}" #################################################################################################### #### SlickStack: Reset Permissions (SlickStack Scripts) ############################################ #################################################################################################### ## we include this permissions reset in all cron jobs and bash scripts for redundancy ## ## chmod 0700 means only the root/sudo users can execute any SlickStack scripts ## ## THIS SNIPPET DOES NOT RELY ON SS-CONFIG OR SS-FUNCTIONS ## SNIPPET: ss bash scripts, ss cron jobs ## UPDATED: 02JUL2022 chown root:root /var/www/ss* ## must be root:root chown root:root /var/www/crons/*cron* ## must be root:root chown root:root /var/www/crons/custom/*cron* ## must be root:root chmod 0700 /var/www/ss* ## 0700 means only root/sudo can execute chmod 0700 /var/www/crons/*cron* ## 0700 means only root/sudo can execute chmod 0700 /var/www/crons/custom/*cron* ## 0700 means only root/sudo can execute #################################################################################################### #### 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 ## Ref: https://slickstack.io/forum/topic/many-installation-issues ## SS_EOF