Skip to content

Commit

Permalink
update update_ui to avoid use of requiring a version number
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Dec 6, 2023
1 parent 27790b4 commit 1898551
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
4 changes: 4 additions & 0 deletions workspace/scripts/files/bash/local_access_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ sudo nmcli connection modify PioreactorAP 802-11-wireless-security.key-mgmt wpa-
sudo nmcli connection modify PioreactorAP 802-11-wireless-security.proto "$(crudini --get /home/pioreactor/.pioreactor/config.ini local_access_point proto 2> /dev/null || echo 'rsn')"
sudo nmcli connection modify PioreactorAP 802-11-wireless-security.psk "$(crudini --get /home/pioreactor/.pioreactor/config.ini local_access_point passphrase)"
sudo nmcli connection modify PioreactorAP 802-11-wireless.band bg
#sudo nmcli connection modify PioreactorAP wifi-sec.pmf disable
#sudo nmcli connection modify PioreactorAP 802-11-wireless-security.pmf 1



sudo nmcli con up PioreactorAP
28 changes: 16 additions & 12 deletions workspace/scripts/files/bash/update_ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,36 @@ set -e
export LC_ALL=C

SRC_TAR=$1
TAG=$2

TEMP_DIR=$(mktemp -d -t "pioreactorui_XXXX")
UI_FOLDER=/var/www/pioreactorui
SRC_FOLDER=/tmp/pioreactorui-"$TAG"

function finish {
# cleanup
rm -rf "$SRC_FOLDER" || true
rm -rf "$TEMP_DIR" || true
sudo systemctl restart lighttpd.service
sudo systemctl restart huey.service
}
trap finish EXIT


# unpack source provided
tar -xvzf "$SRC_TAR" -C /tmp
tar -xzf "$SRC_TAR" -C $TEMP_DIR
WORK_DIR=$(find "$TEMP_DIR" -mindepth 1 -maxdepth 1 -type d) # get the directory inside the archive, name is not predictable.

echo $WORK_DIR
# Verify that WORK_DIR is valid
if [[ -z "$WORK_DIR" ]]; then
echo "Failed to find the working directory inside TEMP_DIR"
exit 1
fi

# copy data over
# use rsync because we want to merge custom yamls the user has, we any updates to our own yamls.
rsync -ap --ignore-existing $UI_FOLDER/contrib/ "$SRC_FOLDER"/contrib/ 2>/dev/null || :
cp -p $UI_FOLDER/.env "$SRC_FOLDER" 2>/dev/null || :
rsync -ap --ignore-existing $UI_FOLDER/contrib/ $WORK_DIR/contrib/ 2>/dev/null || :
cp -p $UI_FOLDER/.env $WORK_DIR 2>/dev/null || :

# swap folders
sudo rm -rf $UI_FOLDER
rm -rf $UI_FOLDER
mkdir $UI_FOLDER
cp -rp "$SRC_FOLDER"/. $UI_FOLDER
sudo chgrp -R www-data $UI_FOLDER


cp -rp $WORK_DIR/. $UI_FOLDER
chgrp -R www-data $UI_FOLDER

0 comments on commit 1898551

Please sign in to comment.