Script for updating code and save data
This commit is contained in:
parent
984c1a14ec
commit
74ed83486b
1 changed files with 33 additions and 0 deletions
33
update-bikeparts.sh
Normal file
33
update-bikeparts.sh
Normal file
|
@ -0,0 +1,33 @@
|
|||
# rudimentary script for saving changes and update code
|
||||
# need to fill in the following variables:
|
||||
BACKUPDIR="<insert here>"
|
||||
DATA_LOCATION="<absolute path to data repository>"
|
||||
CODE_LOCATION="<absolute path to gui code repository>"
|
||||
WAREHOUSE="<name of the place the inventory is for. The corresponding branch is WAREHOUSE-main>"
|
||||
|
||||
set -e
|
||||
systemctl stop flinventory-gui.service
|
||||
now="$(date +%y-%m-%dT%H%M%S)"
|
||||
backupdir="/root/backup-flinventory/${now}/"
|
||||
echo "${backupdir}"
|
||||
mkdir -p "${backupdir}"
|
||||
cd "${DATA_LOCATION}"
|
||||
cp locations.json parts.json "${backupdir}"
|
||||
|
||||
branchname="website-changes-${WAREHOUSE}-${now}"
|
||||
git switch -c "${branchname}"
|
||||
git add parts.json
|
||||
git commit -m "[for main] changes to parts.json via Website" || true
|
||||
git add locations.json
|
||||
git commit -m "[for ${WAREHOUSE}] changes to locations.json via Website" || true
|
||||
git add .
|
||||
git commit -m "[?] other changes via Website" || true # allow empty commit
|
||||
git push -u origin "${branchname}"
|
||||
git switch "${WAREHOUSE}-main"
|
||||
git pull
|
||||
cd "${CODE_LOCATION}/flinventory"
|
||||
git pull
|
||||
cd "${CODE_LOCATION}"
|
||||
git pull --recurse-submodules=yes
|
||||
systemctl start flinventory-gui.service
|
||||
systemctl status flinventory-gui.service
|
Loading…
Reference in a new issue