mirror of
https://github.com/outbackdingo/scratchpkg.git
synced 2026-01-28 10:20:13 +00:00
add sysusers option and fix some bugs
This commit is contained in:
@@ -4,11 +4,12 @@ BINDIR=/usr/bin
|
||||
FUNCDIR=/usr/share/scratchpkg
|
||||
CONFDIR=/etc
|
||||
HOOK_DIR=/etc/hooks
|
||||
SYSUSERS_DIR=/etc/sysusers
|
||||
CACHE_DIR=/var/cache/scratchpkg
|
||||
INDEX_DIR=/var/lib/scratchpkg
|
||||
PORT_DIR=/usr/ports
|
||||
|
||||
mkdir -pv ${DESTDIR}{${BINDIR},${FUNCDIR},${CONFDIR},${HOOK_DIR},${PORT_DIR}}
|
||||
mkdir -pv ${DESTDIR}{${BINDIR},${FUNCDIR},${CONFDIR},${HOOK_DIR},${SYSUSERS_DIR},${PORT_DIR}}
|
||||
install -m755 revdep buildpkg installpkg removepkg scratch ${DESTDIR}${BINDIR}
|
||||
install -m644 functions/* ${DESTDIR}${FUNCDIR}
|
||||
install -m644 scratchpkg.conf scratchpkg.repo ${DESTDIR}${CONFDIR}
|
||||
|
||||
2
buildpkg
2
buildpkg
@@ -8,7 +8,7 @@ backupconf() {
|
||||
for bkp in ${backup[@]}; do
|
||||
if [ ! -f $bkp ]; then
|
||||
msgerr "File '$bkp' not exist!"
|
||||
exit 1
|
||||
exitscript1
|
||||
else
|
||||
mv $bkp $bkp.spkgnew
|
||||
fi
|
||||
|
||||
@@ -18,6 +18,7 @@ SOURCE_DIR="/var/cache/scratchpkg/sources"
|
||||
WORK_DIR="/tmp"
|
||||
LOG_DIR="/var/cache/scratchpkg/log"
|
||||
HOOK_DIR="/etc/hooks"
|
||||
SYSUSERS_DIR="/etc/sysusers"
|
||||
|
||||
OPTIONS=(!libtool emptydirs strip docs purge zipman buildflags makeflags)
|
||||
PURGE_FILES=(usr/{,share/}info/dir)
|
||||
|
||||
36
installpkg
36
installpkg
@@ -66,7 +66,7 @@ installpkg() {
|
||||
#installing package into system
|
||||
msg2 "Extracting package..."
|
||||
installcmd() {
|
||||
tar --keep-directory-symlink --no-overwrite-dir -p -x -v -f $1 -C $ROOT_DIR --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]}
|
||||
tar --keep-directory-symlink -p -x -v -f $1 -C $ROOT_DIR --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]}
|
||||
}
|
||||
|
||||
rm -f /tmp/spkginstall.$name
|
||||
@@ -134,6 +134,8 @@ installpkg() {
|
||||
msg2 "This package has ${GREEN}readme${CRESET}"
|
||||
fi
|
||||
|
||||
sysusers
|
||||
|
||||
runhooks
|
||||
|
||||
msg "Successfully $oprmsg ${GREEN}$name-$version-$release${CRESET}."
|
||||
@@ -305,6 +307,38 @@ runhooks() {
|
||||
|
||||
}
|
||||
|
||||
sysusers() {
|
||||
|
||||
if [ "$(ls $SYSUSERS_DIR/*.conf 2>/dev/null)" ]; then
|
||||
for file in $(ls $SYSUSERS_DIR/*.conf); do
|
||||
while read uid gid mode dir junk; do
|
||||
# Ignore comments and blank lines
|
||||
case "${uid}" in
|
||||
""|\#*) continue ;;
|
||||
esac
|
||||
if [ -e "$dir" ]; then
|
||||
if [ "$uid" != '-' ]; then
|
||||
getent passwd $uid >/dev/null
|
||||
if [[ "$?" = 0 ]]; then
|
||||
chown "$uid" "$dir"
|
||||
fi
|
||||
fi
|
||||
if [ "$gid" != '-' ]; then
|
||||
getent group $gid >/dev/null
|
||||
if [[ "$?" = 0 ]]; then
|
||||
chgrp "$gid" "$dir"
|
||||
fi
|
||||
fi
|
||||
if [ "$mode" != '-' ]; then
|
||||
chmod "$mode" "$dir"
|
||||
fi
|
||||
fi
|
||||
done < "$file"
|
||||
done
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
help() {
|
||||
|
||||
cat << EOF
|
||||
|
||||
@@ -20,6 +20,7 @@ MAKEFLAGS="-j2"
|
||||
# WORK_DIR="/tmp"
|
||||
# LOG_DIR="/var/cache/scratchpkg/log"
|
||||
# HOOK_DIR="/etc/hooks"
|
||||
# SYSUSERS_DIR="/etc/sysusers"
|
||||
|
||||
##
|
||||
## GLOBAL PACKAGE OPTIONS
|
||||
|
||||
Reference in New Issue
Block a user