-
Notifications
You must be signed in to change notification settings - Fork 0
/
postinst
executable file
·60 lines (45 loc) · 1.92 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
PID="com.apptuckerbox.register"
SID="com.apptuckerbox.service"
APPS=/media/cryptofs/apps
[ -d $APPS ] || { echo "Requires webOS 1.3.5 or later" ; exit 1 ; }
# Remove the service executable
rm -f /var/usr/sbin/${SID}
# Remove the dbus service
rm -f /var/palm/system-services/${SID}.service
# Remove the ls2 roles
rm -f /var/palm/ls2/roles/prv/${SID}.json
rm -f /var/palm/ls2/roles/pub/${SID}.json
# Stop the service if running
/sbin/stop ${SID} || true
/usr/bin/killall -9 ${SID} || true
# Remove the upstart script
rm -f /etc/event.d/${SID} /var/palm/event.d/${SID}
# Install the service executable
mkdir -p /var/usr/sbin/
install -m 755 $APPS/usr/palm/applications/${PID}/bin/${SID} /var/usr/sbin/${SID}
# Install the dbus service
mkdir -p /var/palm/system-services
cp $APPS/usr/palm/applications/${PID}/dbus/${SID}.service /var/palm/system-services/${SID}.service
# Install the ls2 roles
mkdir -p /var/palm/ls2/roles/prv /var/palm/ls2/roles/pub
cp $APPS/usr/palm/applications/${PID}/dbus/${SID}.json /var/palm/ls2/roles/prv/${SID}.json
cp $APPS/usr/palm/applications/${PID}/dbus/${SID}.json /var/palm/ls2/roles/pub/${SID}.json
/usr/bin/ls-control scan-services || true
# Install the upstart script
mkdir -p /var/palm/event.d
cp $APPS/usr/palm/applications/${PID}/upstart/${SID} /var/palm/event.d/${SID}
# Install the certificate authority
if grep PRODUCT_VERSION_STRING /etc/palm-build-info | grep 1.4.5 > /dev/null ; then
if ! grep Preware /etc/ssl/certs/ca-certificates.crt > /dev/null ; then
mount -o remount,rw /
cat $APPS/usr/palm/applications/${PID}/certs/preware-ca-bundle.crt >> /etc/ssl/certs/ca-certificates.crt
mount -o remount,ro /
fi
else
mkdir -p /var/ssl/trustedcerts
cp $APPS/usr/palm/applications/${PID}/certs/preware-ca-bundle.crt /var/ssl/trustedcerts/397bdadc.0
fi
# Start the service
/sbin/start ${SID}
exit 0