pkgr 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8286cde02aee6871c83a01b3e4bde67d7e2c064d
4
- data.tar.gz: 7e835d88af2324a41ec228e5493acf6f4e1b52cf
3
+ metadata.gz: a4e3a70c418cef9f50841398e35eed52f1101f85
4
+ data.tar.gz: 8820bd24da8af9c77431e512b4deeb275c4f8a65
5
5
  SHA512:
6
- metadata.gz: 7a275a87b5c5b14ffbf62d0740dfae27474b4dab84ed184c06a456170a8b5758b22fa7f0329f847f06901d3e521c1f46a3c9430512f07af09db84acdc0d58d2d
7
- data.tar.gz: 20d5a23367770c6aab4a61f0d73fb4829c98d1f55258d59647642777e60e165c3dda87730e00d3f8b3d7b4ba5afe75d5fdeec81b239a11b4647f352761209bd4
6
+ metadata.gz: acfb11a093245ef31b8f53e29014e229f8dd1befc90afb446e829f8e2ec0825ad0aa13e38c2901cb5b74dc0bc0f9196b9ac116e69aa244a9236e7dcb07465ffe
7
+ data.tar.gz: a70f79e56a29d9523178e4907dff16d36996b3b725a04c269520fa61e94ed1f6a2daef33e72419fce743eb177943f8ab0f34d01540250fb42193a84dbea94766
@@ -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 [ `id -u` -ne 0 ]; then
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
- exec chroot --userspec ${APP_USER}:${APP_GROUP} "/" sh -c "cd $(_p ${APP_HOME}) && $runnable"
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
 
@@ -1,3 +1,3 @@
1
1
  module Pkgr
2
- VERSION = "1.4.2"
2
+ VERSION = "1.4.3"
3
3
  end
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.2
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-02-27 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake