pkgr 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/cli/cli.sh.erb +25 -5
- data/lib/pkgr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4e3a70c418cef9f50841398e35eed52f1101f85
|
4
|
+
data.tar.gz: 8820bd24da8af9c77431e512b4deeb275c4f8a65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acfb11a093245ef31b8f53e29014e229f8dd1befc90afb446e829f8e2ec0825ad0aa13e38c2901cb5b74dc0bc0f9196b9ac116e69aa244a9236e7dcb07465ffe
|
7
|
+
data.tar.gz: a70f79e56a29d9523178e4907dff16d36996b3b725a04c269520fa61e94ed1f6a2daef33e72419fce743eb177943f8ab0f34d01540250fb42193a84dbea94766
|
data/data/cli/cli.sh.erb
CHANGED
@@ -34,16 +34,16 @@ DEFAULT_FILE=$(_p "/etc/default/${APP_NAME}")
|
|
34
34
|
|
35
35
|
for file in $(_p "${APP_HOME}/.profile.d")/*.sh; do
|
36
36
|
# .profile.d scripts assume HOME indicates the path to the app directory
|
37
|
-
if [ -f $file ]; then HOME=${APP_HOME} . $file; fi
|
37
|
+
if [ -f $file ]; then HOME=${APP_HOME} . $file &>/dev/null; fi
|
38
38
|
done
|
39
39
|
|
40
40
|
if [ "$APP_CLI" != "" ] ; then
|
41
41
|
exec $APP_HOME/bin/$APP_CLI "$@"
|
42
42
|
fi
|
43
43
|
|
44
|
-
if [
|
45
|
-
echo "You must be executing with root privileges to launch commands."
|
46
|
-
echo "Either log in as root, use sudo, or add sudo privileges for running ${APP_NAME} with your user."
|
44
|
+
if [ ! -w "$(_p "/etc/${APP_NAME}/conf.d")" ] ; then
|
45
|
+
echo "Error: You must be executing as the user '${APP_USER}' or with root privileges to launch commands."
|
46
|
+
echo "Either log in as '${APP_USER}', root, use sudo, or add sudo privileges for running ${APP_NAME} with your current user."
|
47
47
|
exit 1
|
48
48
|
fi
|
49
49
|
|
@@ -53,6 +53,15 @@ for file in $(_p "/etc/${APP_NAME}/conf.d")/*; do
|
|
53
53
|
if [ -f $file ]; then . $file; fi
|
54
54
|
done
|
55
55
|
|
56
|
+
# Some actions require root privileges
|
57
|
+
ensure_root() {
|
58
|
+
if [ $(id -u) -ne 0 ]; then
|
59
|
+
echo "Error: You must be executing with root privileges to use this command."
|
60
|
+
echo "Either log in as root, use sudo, or add sudo privileges for running ${APP_NAME} with your user."
|
61
|
+
exit 1
|
62
|
+
fi
|
63
|
+
}
|
64
|
+
|
56
65
|
# Return all the environment variables accessible to the app.
|
57
66
|
show_env() {
|
58
67
|
env -i ROOT_PATH=${ROOT_PATH} ${0} run env | sort
|
@@ -260,11 +269,18 @@ while : ; do
|
|
260
269
|
# Do not use su, to avoid creating a new process. Note: chroot version
|
261
270
|
# is too old on Ubuntu Lucid, so this will fail. It works on Debian
|
262
271
|
# Squeeze though (and later).
|
263
|
-
|
272
|
+
# Do not chroot if current user is APP_USER.
|
273
|
+
if [ $(id -u) = $(id -u ${APP_USER}) ]; then
|
274
|
+
exec sh -c "cd $(_p ${APP_HOME}) && $runnable"
|
275
|
+
else
|
276
|
+
exec chroot --userspec ${APP_USER}:${APP_GROUP} "/" sh -c "cd $(_p ${APP_HOME}) && $runnable"
|
277
|
+
fi
|
264
278
|
|
265
279
|
break ;;
|
266
280
|
|
267
281
|
scale)
|
282
|
+
ensure_root
|
283
|
+
|
268
284
|
shift
|
269
285
|
for arg in "$@"; do
|
270
286
|
[ "$arg" = "" ] && usage
|
@@ -313,10 +329,14 @@ while : ; do
|
|
313
329
|
break;;
|
314
330
|
|
315
331
|
configure)
|
332
|
+
ensure_root
|
333
|
+
|
316
334
|
configure $@
|
317
335
|
break;;
|
318
336
|
|
319
337
|
reconfigure)
|
338
|
+
ensure_root
|
339
|
+
|
320
340
|
reconfigure $@
|
321
341
|
break;;
|
322
342
|
|
data/lib/pkgr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pkgr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Rohr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|