This repository has been archived by the owner on Mar 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
package_routines
executable file
·489 lines (421 loc) · 18.5 KB
/
package_routines
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
######################################################################
# REFERENCE OF ALWAYS-AVAILABLE SYSTEM COMMANDS
######################################################################
#CMD_AWK="/bin/awk"
#CMD_CAT="/bin/cat"
#CMD_CHMOD="/bin/chmod"
#CMD_CHOWN="/bin/chown"
#CMD_CP="/bin/cp"
#CMD_CUT="/bin/cut"
#CMD_DATE="/bin/date"
#CMD_ECHO="/bin/echo"
#CMD_EXPR="/usr/bin/expr"
#CMD_FIND="/usr/bin/find"
#CMD_GETCFG="/sbin/getcfg"
#CMD_GREP="/bin/grep"
#CMD_GZIP="/bin/gzip"
#CMD_HOSTNAME="/bin/hostname"
#CMD_LN="/bin/ln"
#CMD_LOG_TOOL="/sbin/log_tool"
#CMD_MD5SUM="/bin/md5sum"
#CMD_MKDIR="/bin/mkdir"
#CMD_MV="/bin/mv"
#CMD_RM="/bin/rm"
#CMD_RMDIR="/bin/rmdir"
#CMD_SED="/bin/sed"
#CMD_SETCFG="/sbin/setcfg"
#CMD_SLEEP="/bin/sleep"
#CMD_SORT="/usr/bin/sort"
#CMD_SYNC="/bin/sync"
#CMD_TAR="/bin/tar"
#CMD_TOUCH="/bin/touch"
#CMD_WGET="/usr/bin/wget"
#CMD_WLOG="/sbin/write_log"
#CMD_XARGS="/usr/bin/xargs"
#CMD_7Z="/usr/local/sbin/7z"
######################################################################
# REFERENCE OF IMPORTANT SYSTEM FILES/VARIABLES
######################################################################
#SYS_CONFIG_DIR="/etc/config"
#SYS_INIT_DIR="/etc/init.d"
#SYS_STARTUP_DIR="/etc/rcS.d"
#SYS_SHUTDOWN_DIR="/etc/rcK.d"
#SYS_RSS_IMG_DIR="/home/httpd/RSS/images"
#SYS_QPKG_DATA_FILE_GZIP="./data.tar.gz"
#SYS_QPKG_DATA_FILE_BZIP2="./data.tar.bz2"
#SYS_QPKG_DATA_FILE_7ZIP="./data.tar.7z"
#SYS_QPKG_DATA_CONFIG_FILE="./conf.tar.gz"
#SYS_QPKG_DATA_MD5SUM_FILE="./md5sum"
#SYS_QPKG_DATA_PACKAGES_FILE="./Packages.gz"
#SYS_QPKG_CONFIG_FILE="$SYS_CONFIG_DIR/qpkg.conf"
#SYS_QPKG_CONF_FIELD_QPKGFILE="QPKG_File"
#SYS_QPKG_CONF_FIELD_NAME="Name"
#SYS_QPKG_CONF_FIELD_VERSION="Version"
#SYS_QPKG_CONF_FIELD_ENABLE="Enable"
#SYS_QPKG_CONF_FIELD_DATE="Date"
#SYS_QPKG_CONF_FIELD_SHELL="Shell"
#SYS_QPKG_CONF_FIELD_INSTALL_PATH="Install_Path"
#SYS_QPKG_CONF_FIELD_CONFIG_PATH="Config_Path"
#SYS_QPKG_CONF_FIELD_WEBUI="WebUI"
#SYS_QPKG_CONF_FIELD_WEBPORT="Web_Port"
#SYS_QPKG_CONF_FIELD_SERVICEPORT="Service_Port"
#SYS_QPKG_CONF_FIELD_SERVICE_PIDFILE="Pid_File"
#SYS_QPKG_CONF_FIELD_AUTHOR="Author"
#SYS_QPKG_CONF_FIELD_RC_NUMBER="RC_Number"
#SYS_EXTRACT_DIR="$(pwd)"
######################################################################
# REFERENCE OF AUTO-ASSIGNED MACHINE-DEPENDENT VARIABLES
######################################################################
#SYS_HOSTNAME=$($CMD_HOSTNAME)
## One of: SYS_QPKG_DATA_FILE_GZIP, SYS_QPKG_DATA_FILE_BZIP2 or SYS_QPKG_DATA_FILE_7ZIP.
#SYS_QPKG_DATA_FILE=""
## Destination volume (e.g. "/share/MD0_DATA").
#SYS_QPKG_BASE=""
## Destination path for all QPKG packages ("$SYS_QPKG_BASE/.qpkg").
#SYS_QPKG_INSTALL_PATH=""
## Destination path for this QPKG package ("$SYS_QPKG_INSTALL_PATH/$QPKG_NAME").
#SYS_QPKG_DIR=""
## Should the QPKG be enabled or disabled after the installation/upgrade? By default, 'TRUE' for installation and the previous state for upgrade operation. If 'TRUE' and start fails, the QPKG is disabled.
#SYS_QPKG_SERVICE_ENABLED="TRUE"
## Architecture of the device the QPKG is installed on.
#SYS_CPU_ARCH=""
## Name and location of system shares
#SYS_PUBLIC_SHARE=""
#SYS_PUBLIC_PATH=""
#SYS_DOWNLOAD_SHARE=""
#SYS_DOWNLOAD_PATH=""
#SYS_MULTIMEDIA_SHARE=""
#SYS_MULTIMEDIA_PATH=""
#SYS_RECORDINGS_SHARE=""
#SYS_RECORDINGS_PATH=""
#SYS_USB_SHARE=""
#SYS_USB_PATH=""
#SYS_WEB_SHARE=""
#SYS_WEB_PATH=""
## Path to ipkg or opkg package tool if installed.
#CMD_PKG_TOOL=""
######################################################################
# REFERENCE OF OUR VARIABLES
######################################################################
## Entware dependency QPKG name.
ENTWARE_NAME="Entware"
CNF_CHKSM_NAME="config.checksum"
## Installation log file.
QPKG_LOG_FILE="/var/log/coldsweat-install-tmp.log"
## Default Coldsweat username.
CS_DEFAULT_USERNAME="coldsweat"
CS_DEFAULT_PASSWORD="coldsweat"
CS_DEFAULT_EMAIL="coldsweat@my-qnap.com"
######################################################################
# REFERENCE OF OUR COMMANDS
######################################################################
CMD_OPKG="$SYS_QPKG_INSTALL_PATH/$ENTWARE_NAME/bin/opkg"
CMD_PATCH="$SYS_QPKG_INSTALL_PATH/$ENTWARE_NAME/bin/patch"
CMD_PIP="$SYS_QPKG_INSTALL_PATH/$ENTWARE_NAME/bin/pip"
CMD_PYTHON="$SYS_QPKG_INSTALL_PATH/$ENTWARE_NAME/bin/python"
CMD_MAKE="$SYS_QPKG_INSTALL_PATH/$ENTWARE_NAME/bin/make"
CMD_UNZIP="$SYS_QPKG_INSTALL_PATH/$ENTWARE_NAME/bin/unzip"
FILE_GCC_ENV="$SYS_QPKG_INSTALL_PATH/$ENTWARE_NAME/bin/gcc_env.sh"
######################################################################
# TIPS & HELPERS
######################################################################
## Useful tips:
# - 'help test' for more information on Shell tests
# - engine ignores any values returned by the principal functions
# - all variables defined in 'qpkg.cfg' are automatically passed
## Useful predefined helper functions:
# - command: log <msg>
# - outputs <msg> to stdout AND system log
# - command: warn_log <msg>
# - outputs <msg> to stderr AND system log
# - command: err_log <msg>
# - outputs <msg> to stderr AND system log
# - alerts the web interface and prevents the installation/upgrade from proceeding
# - example: err_log "Data file not found." => "myApp 0.1 installation failed. Data file not found."
# - command: get_share_path <share-name> <variable>
# - <variable> will now hold real path to the given share (e.g. not '/share/<share-name>')
# - command: add_qpkg_config <config-file> <md5sum>
# - add a configuration file to '$SYS_QPKG_CONFIG_FILE', if not already present
# - <md5sum> refers to the file included in the package (should be 0 for dynamically generated files)
# - command: set_qpkg_config <config-file> <md5sum>
# - update the <md5sum> of an existing configuration file
# - command: extract_data <archive> <directory>
# - extract the given TAR archive to the given directory ('$SYS_QPKG_DIR' by default)
# - commands: is_equal, is_unequal, is_less_or_equal, is_less, is_greater, is_greater_or_equal
# - QPKG version comparison - take two arguments (strings) and return 0 if the test is successful
## Usage for the '/sbin/getcfg' command:
# Usage: getcfg section field [ -f profile ] [ -d def_value ] [ -c ] [ -u ]
# -f profile - Specify the path of the profile
# -d def_value - Specify default value to be returned on failure
# -c - Section and field names are case sensitive
# -u - Convert result to upper case
restore_state()
{
# restore original PATH
export PATH="$PATH_BCKP"
# move the temporary log
$CMD_MV "$QPKG_LOG_FILE" "$SYS_QPKG_DIR/install.log"
# and finally, restore the original IO state
exec &>/dev/stdout
}
my_exit()
{
# restore the original IO state
restore_state
err_log "$1"
}
######################################################################
# OUR PRE-INSTALLATION INITIALIZATION
######################################################################
# NOTES:
# - "$SYS_QPKG_DIR" hasn't been created yet if we're not upgrading
# First entry point.
pkg_init()
{
# create or truncate the log file
> "$QPKG_LOG_FILE"
# redirect stdout and stderr of this script to the above log file
# Note: eventually, restore the original state with 'exec &>/dev/tty'
exec >> "$QPKG_LOG_FILE"
exec 2>&1
# time to start logging
$CMD_ECHO -e "[Initializing...]"
# backup the current PATH (we will likely change it later on)
export PATH_BCKP="$PATH"
$CMD_ECHO -e "--- PATH backed up"
}
# Second entry point. Supposed to check requirements here.
pkg_check_requirement()
{
# the same requirement is specified in 'qpkg.cfg' but it doesn't hurt to really make sure
if [ -z "$($CMD_GETCFG $ENTWARE_NAME $SYS_QPKG_CONF_FIELD_NAME -f $SYS_QPKG_CONFIG_FILE)" ]; then
my_exit "$ENTWARE_NAME is not installed. See 'https://github.com/Entware/Entware/wiki/Install-on-QNAP-NAS'."
else
$CMD_ECHO -e "--- $ENTWARE_NAME... found"
fi
}
######################################################################
# OUR INSTALLATION
######################################################################
# NOTES:
# - "$SYS_QPKG_DIR" has just been created if we're not upgrading
# - data has just been extracted from '$SYS_QPKG_DATA_FILE', if specified
# - configuration files have just been handled
# Third entry point.
pkg_pre_install()
{
$CMD_ECHO -e "\n[Installing basic tools & python...]"
# install basic python dependencies using Entware (QPKG python is very limited)
$CMD_OPKG update
$CMD_OPKG upgrade
$CMD_OPKG install wget curl
$CMD_OPKG install python python-pip
$CMD_OPKG --force-overwrite install python-dev
$CMD_PIP install --upgrade setuptools
}
# NOTES:
# - shared and platform-dependent files have just been copied to "$SYS_QPKG_DIR"
# Fourth entry point.
pkg_install()
{
# determine whether we're upgrading the package...
IS_UPGRADE="$($CMD_GETCFG $QPKG_NAME $SYS_QPKG_CONF_FIELD_NAME -f $SYS_QPKG_CONFIG_FILE)"
cd "$SYS_QPKG_DIR"
# WARNING: stupid & buggy QDK doesn't set the 'SYS_QPKG_BASE' variable...
CS_DATA_FOLDER="$SYS_QPKG_INSTALL_PATH/.coldsweat"
if [ ! -d "$CS_DATA_FOLDER" ]; then
$CMD_MKDIR "$CS_DATA_FOLDER"
fi
# prepare a uniform installation path for all third-party software...
PREFIX_BUILD="$SYS_QPKG_INSTALL_PATH/$ENTWARE_NAME/local"
if [ ! -d "$PREFIX_BUILD" ]; then
$CMD_MKDIR "$PREFIX_BUILD"
fi
# for the below installation, we have to temporarily alter the PATH...
export PATH="/opt/bin:/opt/sbin:$PATH"
$CMD_ECHO -e "--- '/opt/bin:/opt/sbin' prepended to PATH ahead of time"
# GENERAL NOTE TO THE WHOLE INSTALLATION PROCESS
# It is very straightforward, except that Coldsweat requires the 'gunreadline' python module
# which in turn requires either of:
# 1) A statically compiled GNU readline library on the system AND respective include headers.
# 2) A proper compiler installed on the system.
#
# The 'gnureadline' python module is absent from all Python distributions for QNAP that I know
# of and entware is no exception. #1 is absent from QNAP devices as well and entware's packages
# (including 'libreadline', which is what we need) only contain shared libraries (not static),
# by design, and even don't contain respective include headers needed to compile the 'gnureadline'
# python module. Include headers for entware packages can be installed separately though.
#
# So, possible solutions are:
#
# 1) Cross-compile GNU readline and include it in the QPKG. Personally, I refuse the hassle of
# cross-compilation though. Sorry :).
#
# 2) Getting a proper compiler on your QNAP - all that takes is installing entware and the 'gcc'
# package (beta). Entware doesn't compile statically but I managed to successfully link the
# required python module to a GNU readline static library that I found in QNAP's Qsirch QPKG. God
# knows what version that is, however, and such a 'random' procedure is highly nasty. At first,
# I thought that entware's 'gcc' was not capable of producing working static libraries but luckily,
# I was wrong and that's going to be our direction :).
#
# 3) Entware's 'libreadline' package could, theoretically, be used to skip compiling GNU readline
# BUT that requires a fork of the 'readline' python module.
# UPDATE: as it turns out, even #2 requires a fork of the module because of hardcoded paths and
# the fact that standard PATH only points to startup-loaded system folders (/bin etc.) and the RAM
# disk (/usr) which has incredibly limited capacity. Thank you QNAP...
#
# #2 and #3 are obviously good enough. #2 will result in longer installation time but that's the one
# I'm going with as it's less work for me.
# SEE ALSO: https://github.com/Entware/Entware/wiki/Using-GCC-for-native-compilation
#
$CMD_ECHO -e "\n[Prepare to install GNU readline...]"
# dependencies and recommended tools for gcc to run correctly:
$CMD_ECHO -e "--- Installing tools for GCC to run correctly"
$CMD_OPKG install busybox ldd gawk grep sed
# gcc and things we'll need afterwards
$CMD_ECHO -e "--- Installing compilation tools"
$CMD_OPKG install libncurses gcc make patch
# prepare environment for gcc:
$CMD_ECHO -e "--- Preparing environment for compilation"
source "$FILE_GCC_ENV"
# install a full version of GNU readline, unless already present
$CMD_ECHO -e "\n[Installing GNU readline...]"
if [ ! -f "$PREFIX_BUILD/lib/libreadline.a" ]; then
$CMD_ECHO -e "--- Installing dependencies & utilities"
$CMD_TAR -xf "lib/readline-6.3/readline-6.3.tar.gz"
cd "readline-6.3"
$CMD_ECHO -e "--- Patching the library"
$CMD_PATCH -p0 -t -i "../lib/readline-6.3/readline63-001"
$CMD_PATCH -p0 -t -i "../lib/readline-6.3/readline63-002"
$CMD_PATCH -p0 -t -i "../lib/readline-6.3/readline63-003"
$CMD_PATCH -p0 -t -i "../lib/readline-6.3/readline63-004"
$CMD_PATCH -p0 -t -i "../lib/readline-6.3/readline63-005"
$CMD_PATCH -p0 -t -i "../lib/readline-6.3/readline63-006"
$CMD_PATCH -p0 -t -i "../lib/readline-6.3/readline63-007"
$CMD_PATCH -p0 -t -i "../lib/readline-6.3/readline63-008"
$CMD_ECHO -e "--- Configuring the library"
./configure --prefix="$PREFIX_BUILD"
# append "-fPIC" to CFLAGS... otherwise, we won't be able to compile the python module (see below)
$CMD_SED -i "s/^CFLAGS = \(.*\)$/CFLAGS = \1 -fPIC/" Makefile
$CMD_ECHO -e "--- Compiling the library"
$CMD_MAKE
$CMD_ECHO -e "--- Installing the library"
$CMD_MAKE install
# cleanup
cd ..
$CMD_RM -rf "readline-6.3"
else
$CMD_ECHO -e "--- Skipping... found it installed already"
fi
# install the 'readline' python module for GNU readline
# Note: future versions of this QPKG will take care of upgrade...
$CMD_ECHO -e "\n[Installing 'readline' python module...]"
$CMD_TAR -xf "lib/python-gnureadline-master.tar.gz"
cd "python-gnureadline-master"
export RL_PATH="$PREFIX_BUILD"
$CMD_PYTHON "setup.py" install
cd ..
# cleanup
$CMD_RM -rf "python-gnureadline-master"
# install/upgrade Coldsweat dependencies
$CMD_TAR xf "lib/coldsweat-0.9.7.tar.gz"
$CMD_MV "coldsweat-0.9.7" "coldsweat"
if [ -z "$IS_UPGRADE" ]; then
# if package is being installed
$CMD_ECHO -e "\n[Installing Coldsweat dependencies...]"
$CMD_PIP install -r "coldsweat/requirements.txt"
else
# if package is being upgraded/downgraded, upgrade Coldsweat's dependencies
$CMD_ECHO -e "\n[Upgrading Coldsweat dependencies...]"
$CMD_PIP install -r --upgrade "coldsweat/requirements.txt"
fi
# install Coldsweat's configuration file
$CMD_ECHO -e "\n[Configuring and patching Coldsweat...]"
$CMD_ECHO -e "--- Installing the configuration file"
# Note: use external folder so that important files may survive NAS restart or QPKG uninstall
# Note: if the external configuration file already exists, back it up using a random sequence
CNF_BACKED_UP=false
if [ -f "$CS_DATA_FOLDER/config" ]; then
CNF_CHKSM_OLD=$($CMD_CAT "$CS_DATA_FOLDER/$CNF_CHKSM_NAME")
CNF_CHKSM_NOW=$($CMD_MD5SUM "$CS_DATA_FOLDER/config" | /bin/dd count=32 bs=1 2>/dev/null)
if [ ! -f "$CS_DATA_FOLDER/$CNF_CHKSM_NAME" -o $CNF_CHKSM_OLD != $CNF_CHKSM_NOW ]; then
# if manual modifications were made or we don't have a way to compare, backup the old configuration file
RAND_SEQ=$(/usr/bin/openssl rand -hex 4)
$CMD_MV "$CS_DATA_FOLDER/config" "$CS_DATA_FOLDER/config.$RAND_SEQ"
CNF_BACKED_UP=true
else
# if no manual modifications were made, replace the old configuration file
$CMD_RM "$CS_DATA_FOLDER/config"
fi
fi
$CMD_MV "lib/coldsweat-config" "$CS_DATA_FOLDER/config"
# patch Coldsweat's configuration file point to the right locations
$CMD_ECHO -e "--- Patching the configuration file"
$CMD_SED -i "s:<sqlite-abs-path>:$CS_DATA_FOLDER/sqlite.db:" "$CS_DATA_FOLDER/config"
$CMD_SED -i "s:<log-abs-path>:$CS_DATA_FOLDER/log-app:" "$CS_DATA_FOLDER/config"
# patch Coldsweat to look for the external configuration file
$CMD_ECHO -e "--- Patching Coldsweat to find the configuration file"
$CMD_SED -i "s:os.path.join(installation_dir, 'etc/config'):'$CS_DATA_FOLDER/config':" "coldsweat/coldsweat/__init__.py"
# sorry but this is going to be a little complicated...
if [ ! -z "$IS_UPGRADE" ]; then
# if package is being upgraded/downgraded (not installed)
if [ $CNF_BACKED_UP = false ]; then
# if user HASN'T made any modifications to the configuration file
$CMD_ECHO -e "--- Automatically upgrading Coldsweat's database..."
$CMD_PYTHON "coldsweat/sweat.py" upgrade
else
# if user HAS made modifications to the configuration file
warn_log "QColdsweat: Some manual actions are needed. Please read 'https://github.com/SkyCrawl/qcoldsweat/tree/0.9.7-3#upgrading'."
fi
elif [ ! -f "$CS_DATA_FOLDER/sqlite.db" ]; then
# if package is being installed (not upgraded/downgraded) AND the database doesn't exist yet
$CMD_ECHO -e "--- Creating SQLite database and default account..."
# create database and a default account
# Note: no leading white-spaces on lines between the EOF boundaries
$CMD_PYTHON "coldsweat/sweat.py" setup -u "$CS_DEFAULT_USERNAME" <<EOF
$CS_DEFAULT_EMAIL
$CS_DEFAULT_PASSWORD
$CS_DEFAULT_PASSWORD
EOF
fi
# announce the final phase
$CMD_ECHO -e "\n[Finalizing installation...]"
# backup a checksum of the configuration file (useful above)
$CMD_ECHO -e "--- Backing up configuration file checksum"
$CMD_MD5SUM "$CS_DATA_FOLDER/config" | /bin/dd count=32 bs=1 2>/dev/null > "$CS_DATA_FOLDER/$CNF_CHKSM_NAME"
# patch entware to always find our own installed software
# $CMD_ECHO -e "--- Patching $ENTWARE_NAME to find our own compiled/installed software"
# Note: use single quotes here so that '$PATH' will not be interpreted
# $CMD_SED -i 's|^export PATH=.*$|export PATH=/opt/bin:/opt/sbin:/opt/local/bin:$PATH|' "$SYS_QPKG_INSTALL_PATH/$ENTWARE_NAME/etc/profile"
# cleanup
$CMD_RM -rf "lib"
# and finally, we're done...
$CMD_ECHO -e "\nInstallation finished."
}
# NOTES:
# - obsolete files from the previous installation have just been removed
# - icons have just been copied from QPKG to "/home/httpd/RSS/images/"
# - symbolic links for the service program have just been created in "/etc/init.d", "/etc/rcS.d" and "/etc/rcK.d"
# - the QPKG has just been registered in "/etc/config/qpkg.conf"
pkg_post_install()
{
restore_state
}
######################################################################
# OUR UN-INSTALLATION
######################################################################
# NOTES:
# - The following functions have a generic implementation included in the engine.
# - Variables must be used as "\$VAR" (otherwise, their values will be replaced when the uninstall script is created).
# - Command substitutions ("$(command)" or "`command`") must be escaped, otherwise they will be executed before the script is created.
# PKG_PRE_REMOVE="
# {
# }"
# PKG_MAIN_REMOVE="
# {
# remove system-wide configuration file
# $CMD_RM -f $QPKG_CONFIG
# }"
# PKG_POST_REMOVE="
# {
# }"