mirror of
https://github.com/outbackdingo/scratchpkg.git
synced 2026-01-28 18:20:21 +00:00
add logging, --log
This commit is contained in:
@@ -15,6 +15,7 @@ install -d ${DESTDIR}${REVDEPD}
|
||||
install -dm777 ${DESTDIR}${CACHE_DIR}/packages
|
||||
install -dm777 ${DESTDIR}${CACHE_DIR}/sources
|
||||
install -dm777 ${DESTDIR}${CACHE_DIR}/work
|
||||
install -dm777 ${DESTDIR}${CACHE_DIR}/log
|
||||
|
||||
install -m755 xchroot revdep pkgadd pkgdel pkgbuild pkgquery scratch updateconf ${DESTDIR}${BINDIR}
|
||||
install -m644 scratchpkg.conf scratchpkg.repo scratchpkg.alias ${DESTDIR}${CONFDIR}
|
||||
|
||||
65
scratch
65
scratch
@@ -481,6 +481,7 @@ scratch_build() {
|
||||
while [ "$1" ]; do
|
||||
case $1 in
|
||||
-i|-u|-r|-g|-p) ;;
|
||||
--log) LOGBUILD=1;;
|
||||
-*) OPTS="$OPTS $1";;
|
||||
*) PKGNAME="$PKGNAME $1";;
|
||||
esac
|
||||
@@ -497,7 +498,12 @@ scratch_build() {
|
||||
}
|
||||
cd $ppath
|
||||
settermtitle "Building $pkg..."
|
||||
pkgbuild $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS | tee $LOG_DIR/$pkg.log
|
||||
else
|
||||
pkgbuild $OPTS
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
settermtitle "Building $pkg failed."
|
||||
return 1
|
||||
}
|
||||
@@ -514,6 +520,7 @@ scratch_install() {
|
||||
-r|--reinstall) REINSTALL=1;;
|
||||
-y|--yes) NOCONFIRM=1;;
|
||||
-n|--no-dep) NO_DEP=1;;
|
||||
--log) LOGBUILD=1;;
|
||||
--exclude=*) EXOPT=$1;;
|
||||
-*) OPTS="$OPTS $1";;
|
||||
*) PKGNAME="$PKGNAME $1";;
|
||||
@@ -535,7 +542,12 @@ scratch_install() {
|
||||
else
|
||||
cd $(getportpath $ii)
|
||||
settermtitle "Reinstalling $ii..."
|
||||
pkgbuild $OPTS -r || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -r | tee $LOG_DIR/$ii.log
|
||||
else
|
||||
pkgbuild $OPTS -r
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
break
|
||||
}
|
||||
@@ -559,7 +571,12 @@ scratch_install() {
|
||||
else
|
||||
cd $(getportpath $ii)
|
||||
settermtitle "Installing $ii..."
|
||||
pkgbuild -i $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -i | tee $LOG_DIR/$ii.log
|
||||
else
|
||||
pkgbuild $OPTS -i
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
break
|
||||
}
|
||||
@@ -606,7 +623,12 @@ scratch_install() {
|
||||
if portpathh=$(getportpath $int); then
|
||||
cd $portpathh
|
||||
settermtitle "[ $count/$total ] installing $int..."
|
||||
pkgbuild -i $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -i | tee $LOG_DIR/$int.log
|
||||
else
|
||||
pkgbuild $OPTS -i
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
@@ -700,6 +722,7 @@ scratch_sysup() {
|
||||
-i|-u|-r) ;;
|
||||
-y|--yes) NOCONFIRM=1;;
|
||||
-n|--no-dep) NODEP=1;;
|
||||
--log) LOGBUILD=1;;
|
||||
--exclude=*) EXOPT=$1;;
|
||||
-*) OPTS="$OPTS $1";;
|
||||
esac
|
||||
@@ -756,14 +779,24 @@ scratch_sysup() {
|
||||
cd $(getportpath $inst)
|
||||
if ! isinstalled $inst; then
|
||||
settermtitle "[ $count/$total ] Installing $inst..."
|
||||
pkgbuild -i $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -i | tee $LOG_DIR/$inst.log
|
||||
else
|
||||
pkgbuild $OPTS -i
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
}
|
||||
else
|
||||
settermtitle "[ $count/$total ] Upgrading $inst..."
|
||||
pkgbuild -u $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -u | tee $LOG_DIR/$inst.log
|
||||
else
|
||||
pkgbuild $OPTS-u
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
@@ -785,6 +818,7 @@ scratch_upgrade() {
|
||||
-i|-r) ;;
|
||||
-y|--yes) NOCONFIRM=1;;
|
||||
-d|--no-dep) NO_DEP=1;;
|
||||
--log) LOGBUILD=1;;
|
||||
--exclude=*) EXOPT=$1;;
|
||||
-*) OPTS="$OPTS $1";;
|
||||
*) PKGNAME="$PKGNAME $1";;
|
||||
@@ -853,14 +887,24 @@ scratch_upgrade() {
|
||||
cd $(getportpath $inst)
|
||||
if ! isinstalled $inst; then
|
||||
settermtitle "[ $count/$total ] Installing $inst..."
|
||||
pkgbuild -i $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -i | tee $LOG_DIR/$inst.log
|
||||
else
|
||||
pkgbuild $OPTS -i
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
}
|
||||
else
|
||||
settermtitle "[ $count/$total ] Upgrading $inst..."
|
||||
pkgbuild -u $OPTS || {
|
||||
if [ "$LOGBUILD" = 1 ]; then
|
||||
pkgbuild $OPTS -u | tee $LOG_DIR/$inst.log
|
||||
else
|
||||
pkgbuild $OPTS -u
|
||||
fi
|
||||
[ "$?" = 0 ] || {
|
||||
error=1
|
||||
count=$(( count - 1 ))
|
||||
break
|
||||
@@ -1141,11 +1185,13 @@ Options:
|
||||
-r|--reinstall reinstall
|
||||
-n|--no-dep skip dependencies
|
||||
-y|--yes skip ask user permission
|
||||
--log log build process
|
||||
--exclude=* exclude dependencies, comma separated
|
||||
|
||||
upgrade <ports> <arg> upgrade ports (use pkgbuild arg, except '-i' & '-r')
|
||||
-n|--no-dep skip dependencies
|
||||
-y|--yes skip ask user permission
|
||||
--log log build process
|
||||
--exclude=* exclude dependencies, comma separated
|
||||
|
||||
remove <ports> <arg> remove installed ports (use pkgdel arg)
|
||||
@@ -1154,6 +1200,7 @@ Options:
|
||||
sysup <arg> full system upgrade (use pkgbuild arg, except '-i', '-r' & '-u')
|
||||
-n|--no-dep skip dependencies
|
||||
-y|--yes skip ask user permission
|
||||
--log log build process
|
||||
--exclude=* exclude dependencies, comma separated
|
||||
|
||||
deplist <ports> print all dependencies for ports
|
||||
@@ -1161,6 +1208,7 @@ Options:
|
||||
--exclude=* exclude dependencies, comma separated
|
||||
|
||||
build <ports> <arg> build ports (use pkgbuild arg, except '-i', '-u', '-r', '-g', & '-p')
|
||||
--log log build process
|
||||
|
||||
lock <ports> locking ports prevent upgrade
|
||||
unlock <ports> unlock locked ports
|
||||
@@ -1192,6 +1240,7 @@ ALIAS_FILE="/etc/scratchpkg.alias"
|
||||
# default value from pkgbuild
|
||||
SOURCE_DIR="/var/cache/scratchpkg/sources"
|
||||
PACKAGE_DIR="/var/cache/scratchpkg/packages"
|
||||
LOG_DIR="/var/cache/scratchpkg/log"
|
||||
COMPRESSION_MODE="xz"
|
||||
|
||||
mode=$1
|
||||
|
||||
Reference in New Issue
Block a user