Browse Source

add better support for non-root installations

master
parent
commit
52a9809f25
  1. 22
      openpkg/openpkg.spec

22
openpkg/openpkg.spec

@ -39,7 +39,7 @@
# the package version and release
%define V_openpkg 0.9
%define R_openpkg 31
%define R_openpkg 32
# the used software versions
%define V_rpm 4.0.2
@ -739,6 +739,17 @@ Provides: OpenPKG
%pre
[ ".$1" != .1 ] && exit 0
# this procedure is only usable with root priviledges
# (for non-root installations it is not required at all)
thisuser=`(id -un) 2>/dev/null ||\
(id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
(whoami) 2>/dev/null ||\
(who am i | cut "-d " -f1) 2>/dev/null ||\
echo $LOGNAME`
if [ ".$thisuser" = ".root" ]; then
exit 0
fi
# determine runtime details (for both inside and outside RPM!!)
user="$fsusr"; [ ".$fsusr" = . ] && fsusr="%{l_fsusr}"
group="$fsgrp"; [ ".$fsgrp" = . ] && fsgrp="%{l_fsgrp}"
@ -1004,7 +1015,7 @@ Provides: OpenPKG
if [ ".$1" = .2 ]; then
( sleep 2
%{l_prefix}/bin/rpm --rebuilddb
chown %{l_fsusr}:%{l_fsgrp} %{l_prefix}/RPM/DB/*
chown %{l_fsusr}:%{l_fsgrp} %{l_prefix}/RPM/DB/* || true
) </dev/null >/dev/null 2>/dev/null &
fi
@ -1031,6 +1042,13 @@ Provides: OpenPKG
## trick below.
##
# determine current user
thisuser=`(id -un) 2>/dev/null ||\
(id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\
(whoami) 2>/dev/null ||\
(who am i | cut "-d " -f1) 2>/dev/null ||\
echo $LOGNAME`
# determine runtime details (for both inside and outside RPM!!)
user="%{l_fsusr}"
group="%{l_fsgrp}"

Loading…
Cancel
Save