update
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| update [2023/05/09 21:32] – steve | update [2025/02/04 16:06] (current) – steve | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| <code bash Update> | <code bash Update> | ||
| #!/bin/bash | #!/bin/bash | ||
| - | # | + | # / |
| - | # This allows updating software by a single common command on all my machines | + | # This allows updating software by a single common command on all my machines. |
| + | |||
| Logs=~/ | Logs=~/ | ||
| mkdir -p ${Logs} | mkdir -p ${Logs} | ||
| - | LogFile=${Logs}/ | + | LogFile=${Logs}/ |
| + | |||
| ############################################################################# | ############################################################################# | ||
| ### SRJ 2015-03-27 | ### SRJ 2015-03-27 | ||
| ### machine without further credentials, | ### machine without further credentials, | ||
| - | ### created in / | + | ### created in / |
| - | ### | + | ### ### |
| - | ### | + | ### ## Installation and management of software |
| - | ### | + | ### Cmnd_Alias |
| - | ### | + | ### /usr/bin/dnf, / |
| - | ### -or this, as appropriate- | + | ### / |
| - | ### | + | ### %wheel ALL = NOPASSWD: |
| - | ### | + | ### ### |
| - | ### This allows all users in the ' | + | ### # |
| + | ### ### | ||
| + | ### Cmnd_Alias SOFTWARE_UPDATE = / | ||
| + | ### / | ||
| + | ### %sudo ALL = NOPASSWD: SOFTWARE_UPDATE | ||
| + | ### ### | ||
| + | ### This allows all users in the 'wheel' or 'sudo' group to run updates. ### | ||
| ############################################################################# | ############################################################################# | ||
| + | |||
| source / | source / | ||
| + | |||
| case ${PRETTY_NAME} in | case ${PRETTY_NAME} in | ||
| " | " | ||
| System=" | System=" | ||
| ;; | ;; | ||
| - | + | ||
| - | "Linux Mint 21" | + | "Linux Mint 21.3" |
| System=" | System=" | ||
| ;; | ;; | ||
| + | |||
| + | " | ||
| + | System=" | ||
| + | ;; | ||
| + | |||
| + | " | ||
| + | System=" | ||
| + | ;; | ||
| - | | + | *) |
| System=" | System=" | ||
| echo "This system is unknown, please update this script and add a check" | echo "This system is unknown, please update this script and add a check" | ||
| - | echo "for the pattern ${PRETTY_NAME} | + | echo "for the pattern;" |
| + | echo "${PRETTY_NAME}" | ||
| echo "Then update https:// | echo "Then update https:// | ||
| exit 127 | exit 127 | ||
| ;; | ;; | ||
| esac | esac | ||
| + | |||
| if [[ ${System} == " | if [[ ${System} == " | ||
| - | | + | echo " |
| - | sudo apt upgrade -y | tee -a ${LogFile} | + | |
| - | sudo apt autoremove -y | tee -a ${LogFile} | + | sudo apt-get upgrade -y | tee -a ${LogFile} |
| + | sudo apt-get autoremove -y | tee -a ${LogFile} | ||
| if [ -f / | if [ -f / | ||
| echo 'This system needs to be rebooted!' | echo 'This system needs to be rebooted!' | ||
| else echo "This system doesn' | else echo "This system doesn' | ||
| fi | fi | ||
| + | |||
| elif [[ ${System} == " | elif [[ ${System} == " | ||
| + | echo " | ||
| sudo / | sudo / | ||
| - | | + | sudo /usr/bin/yum -y autoremove | tee -a ${LogFile} |
| - | sudo / | + | |
| Something='' | Something='' | ||
| Something=$(sudo / | Something=$(sudo / | ||
| Line 63: | Line 79: | ||
| else echo 'No restart is required.' | else echo 'No restart is required.' | ||
| fi | fi | ||
| + | |||
| + | elif [[ ${System} == " | ||
| + | echo " | ||
| + | sudo / | ||
| + | sudo / | ||
| + | Something='' | ||
| + | Something=$(sudo / | ||
| + | if [[ ! -z $Something ]]; then | ||
| + | echo 'This machine needs to be restarted!' | ||
| + | else echo 'No restart is required.' | ||
| + | fi | ||
| + | |||
| + | |||
| fi | fi | ||
| </ | </ | ||
update.1683667937.txt.gz · Last modified: by steve
