@@ -481,6 +481,7 @@ scratch_build() {
481481 while [ " $1 " ]; do
482482 case $1 in
483483 -i|-u|-r|-g|-p) ;;
484+ --log) LOGBUILD=1;;
484485 -* ) OPTS=" $OPTS $1 " ;;
485486 * ) PKGNAME=" $PKGNAME $1 " ;;
486487 esac
@@ -497,7 +498,12 @@ scratch_build() {
497498 }
498499 cd $ppath
499500 settermtitle " Building $pkg ..."
500- pkgbuild $OPTS || {
501+ if [ " $LOGBUILD " = 1 ]; then
502+ pkgbuild $OPTS | tee $LOG_DIR /$pkg .log
503+ else
504+ pkgbuild $OPTS
505+ fi
506+ [ " $? " = 0 ] || {
501507 settermtitle " Building $pkg failed."
502508 return 1
503509 }
@@ -514,6 +520,7 @@ scratch_install() {
514520 -r|--reinstall) REINSTALL=1;;
515521 -y|--yes) NOCONFIRM=1;;
516522 -n|--no-dep) NO_DEP=1;;
523+ --log) LOGBUILD=1;;
517524 --exclude=* ) EXOPT=$1 ;;
518525 -* ) OPTS=" $OPTS $1 " ;;
519526 * ) PKGNAME=" $PKGNAME $1 " ;;
@@ -535,7 +542,12 @@ scratch_install() {
535542 else
536543 cd $( getportpath $ii )
537544 settermtitle " Reinstalling $ii ..."
538- pkgbuild $OPTS -r || {
545+ if [ " $LOGBUILD " = 1 ]; then
546+ pkgbuild $OPTS -r | tee $LOG_DIR /$ii .log
547+ else
548+ pkgbuild $OPTS -r
549+ fi
550+ [ " $? " = 0 ] || {
539551 error=1
540552 break
541553 }
@@ -559,7 +571,12 @@ scratch_install() {
559571 else
560572 cd $( getportpath $ii )
561573 settermtitle " Installing $ii ..."
562- pkgbuild -i $OPTS || {
574+ if [ " $LOGBUILD " = 1 ]; then
575+ pkgbuild $OPTS -i | tee $LOG_DIR /$ii .log
576+ else
577+ pkgbuild $OPTS -i
578+ fi
579+ [ " $? " = 0 ] || {
563580 error=1
564581 break
565582 }
@@ -606,7 +623,12 @@ scratch_install() {
606623 if portpathh=$( getportpath $int ) ; then
607624 cd $portpathh
608625 settermtitle " [ $count /$total ] installing $int ..."
609- pkgbuild -i $OPTS || {
626+ if [ " $LOGBUILD " = 1 ]; then
627+ pkgbuild $OPTS -i | tee $LOG_DIR /$int .log
628+ else
629+ pkgbuild $OPTS -i
630+ fi
631+ [ " $? " = 0 ] || {
610632 error=1
611633 count=$(( count - 1 ))
612634 break
@@ -700,6 +722,7 @@ scratch_sysup() {
700722 -i|-u|-r) ;;
701723 -y|--yes) NOCONFIRM=1;;
702724 -n|--no-dep) NODEP=1;;
725+ --log) LOGBUILD=1;;
703726 --exclude=* ) EXOPT=$1 ;;
704727 -* ) OPTS=" $OPTS $1 " ;;
705728 esac
@@ -756,14 +779,24 @@ scratch_sysup() {
756779 cd $( getportpath $inst )
757780 if ! isinstalled $inst ; then
758781 settermtitle " [ $count /$total ] Installing $inst ..."
759- pkgbuild -i $OPTS || {
782+ if [ " $LOGBUILD " = 1 ]; then
783+ pkgbuild $OPTS -i | tee $LOG_DIR /$inst .log
784+ else
785+ pkgbuild $OPTS -i
786+ fi
787+ [ " $? " = 0 ] || {
760788 error=1
761789 count=$(( count - 1 ))
762790 break
763791 }
764792 else
765793 settermtitle " [ $count /$total ] Upgrading $inst ..."
766- pkgbuild -u $OPTS || {
794+ if [ " $LOGBUILD " = 1 ]; then
795+ pkgbuild $OPTS -u | tee $LOG_DIR /$inst .log
796+ else
797+ pkgbuild $OPTS -u
798+ fi
799+ [ " $? " = 0 ] || {
767800 error=1
768801 count=$(( count - 1 ))
769802 break
@@ -785,6 +818,7 @@ scratch_upgrade() {
785818 -i|-r) ;;
786819 -y|--yes) NOCONFIRM=1;;
787820 -d|--no-dep) NO_DEP=1;;
821+ --log) LOGBUILD=1;;
788822 --exclude=* ) EXOPT=$1 ;;
789823 -* ) OPTS=" $OPTS $1 " ;;
790824 * ) PKGNAME=" $PKGNAME $1 " ;;
@@ -853,14 +887,24 @@ scratch_upgrade() {
853887 cd $( getportpath $inst )
854888 if ! isinstalled $inst ; then
855889 settermtitle " [ $count /$total ] Installing $inst ..."
856- pkgbuild -i $OPTS || {
890+ if [ " $LOGBUILD " = 1 ]; then
891+ pkgbuild $OPTS -i | tee $LOG_DIR /$inst .log
892+ else
893+ pkgbuild $OPTS -i
894+ fi
895+ [ " $? " = 0 ] || {
857896 error=1
858897 count=$(( count - 1 ))
859898 break
860899 }
861900 else
862901 settermtitle " [ $count /$total ] Upgrading $inst ..."
863- pkgbuild -u $OPTS || {
902+ if [ " $LOGBUILD " = 1 ]; then
903+ pkgbuild $OPTS -u | tee $LOG_DIR /$inst .log
904+ else
905+ pkgbuild $OPTS -u
906+ fi
907+ [ " $? " = 0 ] || {
864908 error=1
865909 count=$(( count - 1 ))
866910 break
@@ -1141,11 +1185,13 @@ Options:
11411185 -r|--reinstall reinstall
11421186 -n|--no-dep skip dependencies
11431187 -y|--yes skip ask user permission
1188+ --log log build process
11441189 --exclude=* exclude dependencies, comma separated
11451190
11461191 upgrade <ports> <arg> upgrade ports (use pkgbuild arg, except '-i' & '-r')
11471192 -n|--no-dep skip dependencies
11481193 -y|--yes skip ask user permission
1194+ --log log build process
11491195 --exclude=* exclude dependencies, comma separated
11501196
11511197 remove <ports> <arg> remove installed ports (use pkgdel arg)
@@ -1154,13 +1200,15 @@ Options:
11541200 sysup <arg> full system upgrade (use pkgbuild arg, except '-i', '-r' & '-u')
11551201 -n|--no-dep skip dependencies
11561202 -y|--yes skip ask user permission
1203+ --log log build process
11571204 --exclude=* exclude dependencies, comma separated
11581205
11591206 deplist <ports> print all dependencies for ports
11601207 -q|--quick skip installed ports
11611208 --exclude=* exclude dependencies, comma separated
11621209
11631210 build <ports> <arg> build ports (use pkgbuild arg, except '-i', '-u', '-r', '-g', & '-p')
1211+ --log log build process
11641212
11651213 lock <ports> locking ports prevent upgrade
11661214 unlock <ports> unlock locked ports
@@ -1192,6 +1240,7 @@ ALIAS_FILE="/etc/scratchpkg.alias"
11921240# default value from pkgbuild
11931241SOURCE_DIR=" /var/cache/scratchpkg/sources"
11941242PACKAGE_DIR=" /var/cache/scratchpkg/packages"
1243+ LOG_DIR=" /var/cache/scratchpkg/log"
11951244COMPRESSION_MODE=" xz"
11961245
11971246mode=$1
0 commit comments