@@ -104,6 +104,7 @@ RUN_SHELL=
104
104
CCACHE=
105
105
DLNOSIGNATURE=
106
106
CACHE_DIR=/var/cache/build
107
+ MYHOSTNAME=
107
108
108
109
109
110
# This is for insserv
@@ -375,6 +376,7 @@ usage () {
375
376
cleanup_and_exit () {
376
377
trap EXIT
377
378
test -z " $1 " && set 0
379
+ test -n " $2 " && echo " $2 "
378
380
if test -z " $BUILD_OPTIONS_PARSED " ; then
379
381
# if we haven't parsed the options yet we do
380
382
# not know the correct build root. just exit.
@@ -629,34 +631,23 @@ copy_oldpackages() {
629
631
done
630
632
}
631
633
632
- become_root_or_fail () {
633
- if test ! -w /root ; then
634
- echo " You have to be root to use $0 " >&2
635
- exit 1
636
- fi
637
- cleanup_and_exit 1
638
- }
639
-
640
634
mkdir_build_root () {
641
635
# strip trailing slash
642
636
test " $BUILD_ROOT " ! = / && BUILD_ROOT=" ${BUILD_ROOT%/ } "
643
637
if test -d " $BUILD_ROOT " ; then
644
638
# check if it is owned by root
645
639
if test -z " $RUNNING_IN_VM " -a \! -O " $BUILD_ROOT " -a " ` stat -c %u $BUILD_ROOT ` " -ne 0 ; then
646
- echo " BUILD_ROOT=$BUILD_ROOT must be owned by root. Exit..."
647
- cleanup_and_exit 1
640
+ cleanup_and_exit 1 " BUILD_ROOT=$BUILD_ROOT must be owned by root. Exit..."
648
641
fi
649
642
else
650
643
test " $BUILD_ROOT " ! = " ${BUILD_ROOT%/* } " && mkdir -p " ${BUILD_ROOT%/* } "
651
644
if ! mkdir $BUILD_ROOT ; then
652
- echo " can not create BUILD_ROOT=$BUILD_ROOT . Exit..."
653
- cleanup_and_exit 1
645
+ cleanup_and_exit 1 " can not create BUILD_ROOT=$BUILD_ROOT . Exit..."
654
646
fi
655
647
fi
656
648
657
649
if test ! -w " $BUILD_ROOT " ; then
658
- echo " Error: BUILD_ROOT=$BUILD_ROOT not writeable, try --clean."
659
- cleanup_and_exit 3
650
+ cleanup_and_exit 3 " Error: BUILD_ROOT=$BUILD_ROOT not writeable, try --clean."
660
651
fi
661
652
662
653
rm -rf " $BUILD_ROOT /.build.packages"
@@ -912,8 +903,7 @@ while test -n "$1"; do
912
903
-uid)
913
904
needarg
914
905
if test -n " ${ARG// [0-9:]/ } " ; then
915
- echo " --uid argument must be uid:gid"
916
- cleanup_and_exit 1
906
+ cleanup_and_exit 1 " --uid argument must be uid:gid"
917
907
fi
918
908
ABUILD_UID=${ARG%:* }
919
909
ABUILD_GID=${ARG#*: }
@@ -936,17 +926,15 @@ while test -n "$1"; do
936
926
DLNOSIGNATURE=" --nosignature"
937
927
;;
938
928
---noarg)
939
- echo " $ARG does not take an argument"
940
- cleanup_and_exit 1
929
+ cleanup_and_exit 1 " $ARG does not take an argument"
941
930
;;
942
931
-* )
943
932
if vm_parse_options " $@ " ; then
944
933
set -- " ${nextargs[@]} "
945
934
elif recipe_parse_options " $@ " ; then
946
935
set -- " ${nextargs[@]} "
947
936
else
948
- echo " Unknown option '$PARAM '. Exit."
949
- cleanup_and_exit 1
937
+ cleanup_and_exit 1 " Unknown option '$PARAM '. Exit."
950
938
fi
951
939
;;
952
940
* )
@@ -990,11 +978,10 @@ if test -n "$KILL" ; then
990
978
vm_kill
991
979
else
992
980
if ! $BUILD_DIR /killchroot -s 9 $BUILD_ROOT ; then
993
- echo " could not kill build in $BUILD_ROOT "
994
- cleanup_and_exit 1
981
+ cleanup_and_exit 1 " could not kill build in $BUILD_ROOT "
995
982
fi
996
983
fi
997
- cleanup_and_exit 0
984
+ cleanup_and_exit
998
985
fi
999
986
1000
987
if test -n " $CLEAN_BUILD " ; then
@@ -1127,8 +1114,7 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
1127
1114
#
1128
1115
cd " $SRCDIR "
1129
1116
if ! test -s " $RECIPEFILE " ; then
1130
- echo " $RECIPEFILE is empty. This should not happen..."
1131
- cleanup_and_exit 1
1117
+ cleanup_and_exit 1 " $RECIPEFILE is empty. This should not happen..."
1132
1118
fi
1133
1119
MYSRCDIR=" $SRCDIR "
1134
1120
@@ -1161,7 +1147,7 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
1161
1147
1162
1148
if test -n " $VM_TYPE " -a -z " $RUNNING_IN_VM " ; then
1163
1149
vm_first_stage
1164
- cleanup_and_exit 0
1150
+ cleanup_and_exit
1165
1151
fi
1166
1152
1167
1153
if test " $DO_INIT " = true ; then
@@ -1190,8 +1176,7 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
1190
1176
# ensure that old stat is not failing (RHEL4)
1191
1177
if df $BUILD_ROOT 2> /dev/null | grep -q " 100%" ; then
1192
1178
df -h $BUILD_ROOT
1193
- echo " build does not work on a completely full filesystem"
1194
- cleanup_and_exit 1
1179
+ cleanup_and_exit 1 " build does not work on a completely full filesystem"
1195
1180
fi
1196
1181
fi
1197
1182
mount -n -tproc none $BUILD_ROOT /proc || true
@@ -1306,17 +1291,15 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
1306
1291
VM_TELNET_DEVICE=${VM_TELNET_DEVICE# lo }
1307
1292
VM_TELNET_DEVICE=${VM_TELNET_DEVICE%% * }
1308
1293
if test -z " $VM_TELNET_DEVICE " ; then
1309
- echo " ERROR: no network device found for telnet server"
1310
- cleanup_and_exit 1
1294
+ cleanup_and_exit 1 " ERROR: no network device found for telnet server"
1311
1295
fi
1312
1296
if test -x /sbin/ip ; then
1313
1297
ip addr add 10.0.2.15/8 dev ${VM_TELNET_DEVICE}
1314
1298
ip addr add ::1/24 dev ${VM_TELNET_DEVICE}
1315
1299
ip link set ${VM_TELNET_DEVICE} up
1316
1300
else
1317
1301
if ! test -x /sbin/ifconfig ; then
1318
- echo " ERROR: /usr/sbin/in.telnetd is not running, please specify right package via -x option"
1319
- cleanup_and_exit 1
1302
+ cleanup_and_exit 1 " ERROR: /usr/sbin/in.telnetd is not running, please specify correct package via -x option"
1320
1303
fi
1321
1304
ifconfig ${VM_TELNET_DEVICE} 10.0.2.15 up
1322
1305
ifconfig ${VM_TELNET_DEVICE} add ::1/24
@@ -1328,10 +1311,9 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
1328
1311
if test -n " $VM_TELNET " ; then
1329
1312
echo WARNING: telnet option used, setting up telnet server ${VM_TELNET_DEVICE}
1330
1313
if test -x /usr/sbin/in.telnetd; then
1331
- ( /usr/sbin/in.telnetd -L /.build/telnet_login_wrapper -debug 23 & )
1314
+ ( /usr/sbin/in.telnetd -L /.build/telnet_login_wrapper -debug 23 & )
1332
1315
else
1333
- echo " ERROR: /usr/sbin/in.telnetd is not running, please specify right package via -x option"
1334
- cleanup_and_exit 1
1316
+ cleanup_and_exit 1 " ERROR: /usr/sbin/in.telnetd is not running, please specify right package via -x option"
1335
1317
fi
1336
1318
fi
1337
1319
fi
0 commit comments