-
Notifications
You must be signed in to change notification settings - Fork 3
/
postinst
executable file
·45 lines (33 loc) · 1.53 KB
/
postinst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
APPID=org.webosinternals.tailor
NSRVID=org.webosinternals.tailor.node
APPS=/media/cryptofs/apps
[ -d ${APPS} ] || { echo "Requires webOS 1.3.5 or later" ; exit 1 ; }
APPDIR=${APPS}/usr/palm/applications/${APPID}
NSRVDIR=${APPS}/usr/palm/services/${NSRVID}
# Remove the node service executable
rm -f /var/usr/sbin/${NSRVID}
# Remove the node dbus service
rm -f /var/palm/ls2/services/prv/${NSRVID}.service
rm -f /var/palm/ls2/services/pub/${NSRVID}.service
# Remove the node ls2 roles
rm -f /var/palm/ls2/roles/prv/${NSRVID}.json
rm -f /var/palm/ls2/roles/pub/${NSRVID}.json
/usr/bin/ls-control scan-services || true
# Stop the node service if running
/usr/bin/luna-send -n 1 palm://${NSRVID}/__quit '{}'
# Install the node service executable
sed -e '/:${NSRVID}:/d' -i /var/palm/data/jailusers
mkdir -p /var/usr/sbin/
sed -e "s|jail=on|jail=off|" -e "s|SERVICE_PATH=\$1|set ${NSRVDIR}\n\nSERVICE_PATH=\$1|" \
/usr/bin/run-js-service > /var/usr/sbin/${NSRVID}
chmod ugo+x /var/usr/sbin/${NSRVID}
# Override the node dbus service
cp ${NSRVDIR}/${NSRVID}.service /var/palm/ls2/services/prv/${NSRVID}.service
cp ${NSRVDIR}/${NSRVID}.service /var/palm/ls2/services/pub/${NSRVID}.service
# Install the node ls2 roles
mkdir -p /var/palm/ls2/roles/prv /var/palm/ls2/roles/pub
cp ${NSRVDIR}/${NSRVID}.json /var/palm/ls2/roles/prv/${NSRVID}.json
cp ${NSRVDIR}/${NSRVID}.json /var/palm/ls2/roles/pub/${NSRVID}.json
/usr/bin/ls-control scan-services || true
exit 0