mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge pull request #3770 from holta/iiab-update2
Preload all of iiab-update (bash script) into RAM — serious/intermittent errors were arising from the script effectively overwriting itself
This commit is contained in:
commit
1b38d34a31
1 changed files with 108 additions and 97 deletions
|
@ -5,6 +5,12 @@
|
|||
# Also with a focus on upgrading IIAB Calibre-Web, if that's installed:
|
||||
# https://github.com/iiab/calibre-web/wiki
|
||||
|
||||
# 2024-07-18 fixes underway, thanks to:
|
||||
# https://stackoverflow.com/questions/21096478/overwrite-executing-bash-script-files
|
||||
# https://stackoverflow.com/questions/2285403/how-to-make-shell-scripts-robust-to-source-being-changed-as-they-run
|
||||
# https://stackoverflow.com/questions/2336977/can-a-shell-script-indicate-that-its-lines-be-loaded-into-memory-initially
|
||||
|
||||
{
|
||||
if [[ $(id -un) != "root" ]]; then
|
||||
echo -e "\nPlease run: sudo iiab-update\n"
|
||||
exit 1
|
||||
|
@ -31,7 +37,7 @@ if [[ $(git branch --show-current) != "master" || $(git status --porcelain) != "
|
|||
fi
|
||||
echo -e "\n\n\e[4mNow running: git pull https://github.com/iiab/iiab --no-rebase --no-edit\e[0m\n"
|
||||
git pull https://github.com/iiab/iiab --no-rebase --no-edit
|
||||
if [[ $1 == "-f" || $1 == "--fast" ]]; then # Otherwise ./runrole and ./install do it below! (as Ansible runs roles/0-init)
|
||||
if [[ $1 == "-f" || $1 == "--fast" ]]; then # Otherwise ./runrole does it below! (as Ansible runs roles/0-init)
|
||||
cd scripts
|
||||
echo -e "\n\e[4mNow running: cp iiab-update iiab-summary iiab-diagnostics /usr/bin\e[0m\n"
|
||||
cp iiab-update iiab-summary iiab-diagnostics /usr/bin
|
||||
|
@ -61,7 +67,9 @@ if grep -q 'calibreweb_installed: True' /etc/iiab/iiab_state.yml; then
|
|||
echo -e "\n\n\e[41;1mIn /usr/local/calibre-web-py3, (1) 'git branch' MUST show current branch 'master' and (2) 'git status' must show NO MODIFIED FILES.\e[0m\n\n"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "\n\e[4mNow running: git pull https://github.com/iiab/calibre-web --no-rebase --no-edit\e[0m\n"
|
||||
echo -e "\n\e[4mNow running: systemctl stop calibre-web\e[0m\n"
|
||||
systemctl stop calibre-web
|
||||
echo -e "\e[4mNow running: git pull https://github.com/iiab/calibre-web --no-rebase --no-edit\e[0m\n"
|
||||
git pull https://github.com/iiab/calibre-web --no-rebase --no-edit
|
||||
cd /opt/iiab/iiab
|
||||
if [[ $1 == "-f" || $1 == "--fast" ]]; then
|
||||
|
@ -110,3 +118,6 @@ if [ -d /opt/admin ]; then
|
|||
fi
|
||||
|
||||
echo -e "\n\n\e[44;1miiab-update COMPLETE!\e[0m\n\n"
|
||||
|
||||
exit # https://stackoverflow.com/questions/2285403/how-to-make-shell-scripts-robust-to-source-being-changed-as-they-run
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue