Skip to content

Commit fa78764

Browse files
committed
2024-12-09 install.sh - master branch
This PR follows on from discussion in #651 at [@6ffm70](#651 (comment)) post and later. Previously, the `backups` and `services` folders were only created if the `~/IOTstack` folder had just been cloned. As well as "installing", the install script should also function as a "repair" script so it is preferable to always create the `backups` and `services` directories and ensure that they, and their contents, have correct ownership. Signed-off-by: Phill Kelley <[email protected]>
1 parent db08cde commit fa78764

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

install.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
# version - MUST be exactly 7 characters!
4-
UPDATE="2024v02"
4+
UPDATE="2024v03"
55

66
echo " "
77
echo " _____ ____ _______ _ installer _ "
@@ -335,7 +335,6 @@ if [ ! -d "$IOTSTACK" ] ; then
335335
fi
336336
if [ $? -eq 0 -a -d "$IOTSTACK" ] ; then
337337
echo "IOTstack cloned successfully into $IOTSTACK"
338-
mkdir -p "$IOTSTACK/backups" "$IOTSTACK/services"
339338
else
340339
echo "Unable to clone IOTstack (likely a git or network error)"
341340
handle_exit 1
@@ -344,6 +343,13 @@ else
344343
echo -e "\n$IOTSTACK already exists - no need to clone from GitHub"
345344
fi
346345

346+
# ensure backups and services directories exist and are owned by $USER
347+
# https://github.com/SensorsIot/IOTstack/issues/651#issuecomment-2525347511
348+
mkdir -p "$IOTSTACK/backups" "$IOTSTACK/services"
349+
sudo chown -R "$USER:$USER" "$IOTSTACK/backups" "$IOTSTACK/services"
350+
# but, if the influxdb backup dir already exists, put it back to root
351+
[ -d "$IOTSTACK/backups/influxdb" ] && sudo chown -R "root:root" "$IOTSTACK/backups/influxdb"
352+
347353
# initialise docker-compose global environment file with system timezone
348354
if [ ! -f "$IOTSTACK_ENV" ] || [ $(grep -c "^TZ=" "$IOTSTACK_ENV") -eq 0 ] ; then
349355
echo "TZ=$(cat /etc/timezone)" >>"$IOTSTACK_ENV"

0 commit comments

Comments
 (0)