@@ -481,6 +481,7 @@ scratch_build() {
481
481
while [ " $1 " ]; do
482
482
case $1 in
483
483
-i|-u|-r|-g|-p) ;;
484
+ --log) LOGBUILD=1;;
484
485
-* ) OPTS=" $OPTS $1 " ;;
485
486
* ) PKGNAME=" $PKGNAME $1 " ;;
486
487
esac
@@ -497,7 +498,12 @@ scratch_build() {
497
498
}
498
499
cd $ppath
499
500
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 ] || {
501
507
settermtitle " Building $pkg failed."
502
508
return 1
503
509
}
@@ -514,6 +520,7 @@ scratch_install() {
514
520
-r|--reinstall) REINSTALL=1;;
515
521
-y|--yes) NOCONFIRM=1;;
516
522
-n|--no-dep) NO_DEP=1;;
523
+ --log) LOGBUILD=1;;
517
524
--exclude=* ) EXOPT=$1 ;;
518
525
-* ) OPTS=" $OPTS $1 " ;;
519
526
* ) PKGNAME=" $PKGNAME $1 " ;;
@@ -535,7 +542,12 @@ scratch_install() {
535
542
else
536
543
cd $( getportpath $ii )
537
544
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 ] || {
539
551
error=1
540
552
break
541
553
}
@@ -559,7 +571,12 @@ scratch_install() {
559
571
else
560
572
cd $( getportpath $ii )
561
573
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 ] || {
563
580
error=1
564
581
break
565
582
}
@@ -606,7 +623,12 @@ scratch_install() {
606
623
if portpathh=$( getportpath $int ) ; then
607
624
cd $portpathh
608
625
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 ] || {
610
632
error=1
611
633
count=$(( count - 1 ))
612
634
break
@@ -700,6 +722,7 @@ scratch_sysup() {
700
722
-i|-u|-r) ;;
701
723
-y|--yes) NOCONFIRM=1;;
702
724
-n|--no-dep) NODEP=1;;
725
+ --log) LOGBUILD=1;;
703
726
--exclude=* ) EXOPT=$1 ;;
704
727
-* ) OPTS=" $OPTS $1 " ;;
705
728
esac
@@ -756,14 +779,24 @@ scratch_sysup() {
756
779
cd $( getportpath $inst )
757
780
if ! isinstalled $inst ; then
758
781
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 ] || {
760
788
error=1
761
789
count=$(( count - 1 ))
762
790
break
763
791
}
764
792
else
765
793
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 ] || {
767
800
error=1
768
801
count=$(( count - 1 ))
769
802
break
@@ -785,6 +818,7 @@ scratch_upgrade() {
785
818
-i|-r) ;;
786
819
-y|--yes) NOCONFIRM=1;;
787
820
-d|--no-dep) NO_DEP=1;;
821
+ --log) LOGBUILD=1;;
788
822
--exclude=* ) EXOPT=$1 ;;
789
823
-* ) OPTS=" $OPTS $1 " ;;
790
824
* ) PKGNAME=" $PKGNAME $1 " ;;
@@ -853,14 +887,24 @@ scratch_upgrade() {
853
887
cd $( getportpath $inst )
854
888
if ! isinstalled $inst ; then
855
889
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 ] || {
857
896
error=1
858
897
count=$(( count - 1 ))
859
898
break
860
899
}
861
900
else
862
901
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 ] || {
864
908
error=1
865
909
count=$(( count - 1 ))
866
910
break
@@ -1141,11 +1185,13 @@ Options:
1141
1185
-r|--reinstall reinstall
1142
1186
-n|--no-dep skip dependencies
1143
1187
-y|--yes skip ask user permission
1188
+ --log log build process
1144
1189
--exclude=* exclude dependencies, comma separated
1145
1190
1146
1191
upgrade <ports> <arg> upgrade ports (use pkgbuild arg, except '-i' & '-r')
1147
1192
-n|--no-dep skip dependencies
1148
1193
-y|--yes skip ask user permission
1194
+ --log log build process
1149
1195
--exclude=* exclude dependencies, comma separated
1150
1196
1151
1197
remove <ports> <arg> remove installed ports (use pkgdel arg)
@@ -1154,13 +1200,15 @@ Options:
1154
1200
sysup <arg> full system upgrade (use pkgbuild arg, except '-i', '-r' & '-u')
1155
1201
-n|--no-dep skip dependencies
1156
1202
-y|--yes skip ask user permission
1203
+ --log log build process
1157
1204
--exclude=* exclude dependencies, comma separated
1158
1205
1159
1206
deplist <ports> print all dependencies for ports
1160
1207
-q|--quick skip installed ports
1161
1208
--exclude=* exclude dependencies, comma separated
1162
1209
1163
1210
build <ports> <arg> build ports (use pkgbuild arg, except '-i', '-u', '-r', '-g', & '-p')
1211
+ --log log build process
1164
1212
1165
1213
lock <ports> locking ports prevent upgrade
1166
1214
unlock <ports> unlock locked ports
@@ -1192,6 +1240,7 @@ ALIAS_FILE="/etc/scratchpkg.alias"
1192
1240
# default value from pkgbuild
1193
1241
SOURCE_DIR=" /var/cache/scratchpkg/sources"
1194
1242
PACKAGE_DIR=" /var/cache/scratchpkg/packages"
1243
+ LOG_DIR=" /var/cache/scratchpkg/log"
1195
1244
COMPRESSION_MODE=" xz"
1196
1245
1197
1246
mode=$1
0 commit comments