-
Notifications
You must be signed in to change notification settings - Fork 102
/
install-webos-desktop.sh
executable file
·197 lines (171 loc) · 6.63 KB
/
install-webos-desktop.sh
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
# @@@LICENSE
#
# Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# LICENSE@@@
# TODO: Put sudo (only) where needed, so we don't have to run whole script with sudo
# TODO: Consider moving ls2 conf, services, and roles files to traditional location(s):
# Directories=/usr/share/ls2/roles/pub;/var/palm/ls2/roles/pub;/var/mft/palm/ls2/roles/pub
# Directories=/usr/share/dbus-1/services;/var/palm/system-services;/var/palm/ls2/services/pub
set -x
export SCRIPT_DIR=$PWD
source ./webos-desktop-common.sh
if [ "$1" = "--help" ] ; then
echo "Usage: sudo ./install-luna-sysmgr.sh [OPTION]"
echo "Installs the luna-sysmgr component and its dependencies."
echo " NOTE: This script requires sudo privileges"
echo " "
echo "Optional arguments:"
echo " remove Remove the existing install and exit"
echo " --help display this help and exit"
echo " --version display version information and exit"
echo " "
exit
elif [ "$1" = "--version" ] ; then
echo "Desktop install script for Open webOS #3"
exit
elif [ -n "$1" ] && [ "$1" != "remove" ] ; then
echo "Parameter $1 not recognized"
exit
#elif [ ! -d ${ROOTFS} ] || [ ! -d ${ROOTFS}/ls2/roles/prv ] || \
# [ ! -d ${ROOTFS}/usr/palm/frameworks/enyo ] || [ ! -d ${ROOTFS}/usr/palm/applications ] ; then
# # force core-apps to re-install (if missing)
# if [ ! -d ${ROOTFS}/usr/palm/applications ] ; then
# rm -f ${BASE}/core-apps/luna-desktop-build.stamp
# fi
# # force framework to re-install (if missing)
# if [ ! -d ${ROOTFS}/usr/palm/frameworks/enyo ] ; then
# rm -f ${BASE}/enyo-1.0/luna-desktop-build.stamp
# fi
# # force luna-sysmgr to re-install its files
# rm -f ${BASE}/luna-sysmgr/luna-desktop-build.stamp
#
# echo "Please run build-luna-sysmgr.sh first"
# exit
fi
###############################
do_remove_folder() {
if [ -h "$1" ] ; then
unlink "$1"
elif [ -d "$1" ] ; then
rm -rf "$1"/*
rmdir "$1"
fi
}
### First we remove any prior luna-sysmgr install
### The remove option will remove installs from 0.820 and 0.822
### plus this streamlined install script
if [ -d /etc/palm ] ; then
if [ -h /etc/palm ] ; then
unlink /etc/palm
else
# Support remove of 0.822 install
if [ -h /etc/palm/luna-applauncher ] ; then
unlink /etc/palm/luna-applauncher
unlink /etc/palm/luna.conf
unlink /etc/palm/luna-platform.conf
unlink /etc/palm/defaultPreferences.txt
unlink /etc/palm/luna-sysmgr
unlink /etc/palm/launcher3
unlink /etc/palm/schemas
fi
if [ -d /etc/palm/pubsub_handlers ] ; then
unlink /etc/palm/pubsub_handlers/com.palm.appinstaller
rmdir /etc/palm/pubsub_handlers
fi
rm -rf /etc/palm/*
rmdir /etc/palm
fi
if [ "$1" == "remove" ] ; then
echo "Removed support files for luna-sysmgr from /etc/palm"
fi
if [ -h /usr/share/ls2/roles ] ; then
unlink /usr/share/ls2/roles
if [ -d /etc/ls2 ] && [ ! -h /etc/ls2 ] ; then
# Support remove of 0.822 install
unlink /etc/ls2/ls-public.conf
unlink /etc/ls2/ls-private.conf
rmdir /etc/ls2
elif [ -h /etc/ls2 ] ; then
unlink /etc/ls2
fi
if [ "$1" == "remove" ] ; then
echo "Removed support files for luna-sysmgr from /usr/share/ls2 and /etc/ls2"
fi
fi
do_remove_folder /usr/palm
do_remove_folder /var/palm
do_remove_folder /var/luna
do_remove_folder /var/db
do_remove_folder /usr/lib/luna
do_remove_folder /usr/lib/BrowserPlugins
do_remove_folder /usr/lib/BrowserServerPlugin
if [ -h /var/file-cache ] ; then
unlink /var/file-cache
fi
if [ -h /var/usr/palm ] ; then
rm -f /usr/share/dbus-1/services/com.palm.*
rm -f /usr/share/dbus-1/system-services/com.palm.*
unlink /var/usr/palm
fi
# everything now goes in $BASE/rootfs, so remove older dirs from $BASE
rm -rf $BASE/etc
rm -rf $BASE/ls2
rm -rf $BASE/share
rm -rf $BASE/usr
rm -rf $BASE/var
if [ "$1" == "remove" ] ; then
echo "Removed support files for luna-sysmgr from /usr/palm, /usr/share and /var/usr"
exit
fi
elif [ "$1" == "remove" ] ; then
echo "Nothing to remove"
exit
fi
## Verify clean environment
if [ -d /etc/palm ] || [ -d /usr/palm ] || [ -d /var/usr/palm ] || [ -d /var/palm ] ; then
echo "ERR: Previous partial installs remain. Re-run with 'remove' option or "
echo " manually remove links and folders."
exit
fi
### Install the links from restricted folders
### For consistency, creates a few folders which should already exist
echo "Installing links for luna-sysmgr in /etc/ls2, /etc/palm, /usr/palm, "
echo " /var/luna, /var/palm, /usr/lib/luna and /usr/share/ls2"
ln -sf -T ${ROOTFS}/etc/palm /etc/palm
ln -sf -T ${ROOTFS}/etc/ls2 /etc/ls2
mkdir -p /usr/share/ls2
ln -sf -T ${ROOTFS}/usr/share/ls2/roles /usr/share/ls2/roles
# NOTE: desktop ls2 .conf files will look for services in /usr/share/ls2/*services
# NOTE: but on device they live in /usr/share/dbus-1/*services (which is used by Ubuntu dbus)
ln -sf -T ${ROOTFS}/usr/share/ls2/services /usr/share/ls2/services
ln -sf -T ${ROOTFS}/usr/share/ls2/system-services /usr/share/ls2/system-services
ln -sf ${ROOTFS}/usr/palm /usr/palm
# TODO: remove this
#mkdir -p /usr/share/dbus-1/services
#mkdir -p /usr/share/dbus-1/system-services
#cp -fs ${ROOTFS}/share/dbus-1/system-services/com.palm.* /usr/share/dbus-1/system-services
# TODO: remove files installed by previous install script. or not.
#rm -f /usr/share/dbus-1/services/com.palm.*
#rm -f /usr/share/dbus-1/system-services/com.palm.*
ln -sf ${ROOTFS}/var/db /var/db
ln -sf ${ROOTFS}/var/luna /var/luna
ln -sf ${ROOTFS}/var/palm /var/palm
ln -sf ${ROOTFS}/usr/lib/luna /usr/lib/luna
ln -sf ${ROOTFS}/usr/lib/BrowserPlugins /usr/lib/BrowserPlugins
ln -sf ${ROOTFS}/usr/lib/BrowserServerPlugins /usr/lib/BrowserServerPlugins
mkdir -p /var/usr
ln -sf ${ROOTFS}/var/usr/palm /var/usr/palm