File tree Expand file tree Collapse file tree 2 files changed +14
-18
lines changed Expand file tree Collapse file tree 2 files changed +14
-18
lines changed Original file line number Diff line number Diff line change 22echo " Running sg-control postinst in $( pwd) "
33SG=/opt/sensorgnome # would be nice to derive that from some env var...
44
5- # install the default deployment.txt if there is none
6- # some trickery to get a case-insensitive match of deployment.txt
7- DC=/data/config
8- if ! echo $DC /* | egrep -iq /deployment.txt; then
9- echo " Installing default deployment.txt"
10- mkdir -p $DC
11- cp $SG /templates/deployment.txt $DC /deployment.txt
12- fi
13-
14- # install the default tag database if there is none
15- if [[ ! -f $DC /SG_tag_database.sqlite ]]; then
16- echo " Installing default tag database"
17- mkdir -p $DC
18- cp $SG /templates/SG_tag_database.sqlite $DC
19- fi
5+ # install deployment.txt and tag database if not there
6+ SRC=$SG /templates
7+ for f in deployment.txt SG_tag_database.sqlite; do
8+ if [[ -f $SRC /$f ]]; then
9+ # $SRC/$f exists, so this must be an update, put it there unless it exists
10+ [[ -f /data/config/$f ]] || cp $SRC /$f /data/config
11+ else
12+ # $SRC/$f does not exist, so this must be a fresh install, put it into /boot
13+ # it will be copied to $SRC on first boot
14+ [[ -f /boot/$f ]] || cp $SRC /$f /boot
15+ fi
16+ done
2017
2118# enable and start/restart units
2219for U in sg-control; do
Original file line number Diff line number Diff line change @@ -12,10 +12,9 @@ install -d $SG/control
1212cp -r src/* $SG /control
1313sudo chown -R 1000:1000 $SG /control
1414
15- # install default deployment file into templates dir
16- # (can't install to /data/config 'cause that may be on FAT32 and dpkg will fail setting perms)
15+ # install default deployment file and tag database into templates dir
1716sudo install -d $DESTDIR /opt/sensorgnome/templates -o 1000 -g 1000
18- sudo install -o 1000 -g 1000 - m 644 deployment.txt SG_tag_database.sqlite $DESTDIR /opt/sensorgnome/templates
17+ sudo install -m 644 deployment.txt SG_tag_database.sqlite $DESTDIR /opt/sensorgnome/templates
1918
2019# service file should be owned by root
2120sudo install -d $DESTDIR /etc/systemd/system -o 0 -g 0
You can’t perform that action at this time.
0 commit comments