Improved code in bldpkg
This commit is contained in:
parent
5d9b19c210
commit
c6e8906429
1 changed files with 127 additions and 130 deletions
257
bldpkg
257
bldpkg
|
@ -36,7 +36,7 @@ set -e
|
|||
commencedate="$(date '+%a, %d %b %Y, %T')"
|
||||
|
||||
# Then source the configuration file holding all values
|
||||
if [ -f /etc/bldpkg.conf ] ; then
|
||||
if [[ -f /etc/bldpkg.conf ]] ; then
|
||||
source /etc/bldpkg.conf
|
||||
else
|
||||
echo "[ERROR] /etc/bldpkg.conf not found!"
|
||||
|
@ -51,22 +51,19 @@ srcdirpath="$(basename $srcdir)"
|
|||
buildfile="$srcdirpath.SMBuild"
|
||||
|
||||
sourcebuildfile() {
|
||||
# if [ -z "$buildfilealreadysourced" ] ; then
|
||||
if [ -f "$buildfile" ] ; then
|
||||
source "$buildfile"
|
||||
# buildfilealreadysourced=1
|
||||
else
|
||||
# We expect a filename as part of -f argument
|
||||
echo "[ERROR] No build file to source from! If you used -f argument, make sure it is"
|
||||
echo "[ERROR] the first argument pointing to a build file before any other argument."
|
||||
exit 1
|
||||
# fi
|
||||
if [[ -f $buildfile ]] ; then
|
||||
source "$buildfile"
|
||||
else
|
||||
# We expect a filename as part of -f argument
|
||||
echo "[ERROR] No build file to source from! If you used -f argument, make sure it is"
|
||||
echo "[ERROR] the first argument pointing to a build file before any other argument."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
setbuildfile() {
|
||||
buildfile0="$OPTARG"
|
||||
if [ ! -f "$OPTARG" ] ; then
|
||||
if [[ ! -f $OPTARG ]] ; then
|
||||
echo "[ERROR] Build file $buildfile0 not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -123,7 +120,7 @@ genchecksum() {
|
|||
checksumbinary="sha512sum"
|
||||
|
||||
for file in ${files[@]} ; do
|
||||
if [ -f "$file" ] ; then
|
||||
if [[ -f $file ]] ; then
|
||||
$checksumbinary $file >> "$tempbuildfile"
|
||||
fi
|
||||
done
|
||||
|
@ -202,19 +199,19 @@ while getopts ':def:ghj:sx' option; do
|
|||
done
|
||||
|
||||
# If no argument is given, or if argument is greater than 1, invoke sourcebuildfile function.
|
||||
if [ "$OPTIND" -ge 1 ] ; then
|
||||
if [[ $OPTIND -ge 1 ]] ; then
|
||||
sourcebuildfile
|
||||
fi
|
||||
|
||||
# Determine whether we are using bash version 4 and later
|
||||
if [ "${BASH_VERSINFO[0]}" -lt 4 ] ; then
|
||||
if ((BASH_VERSINFO[0] < 4)) ; then
|
||||
echo "[ERROR] bldpkg requires a minimum of bash shell version 4 to run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate the build file. If any of the following variables are not set in the build file, abort.
|
||||
for buildvariables in app version build homepage desc requires ; do
|
||||
if [[ ! "${!buildvariables}" ]] ; then
|
||||
if [[ ! ${!buildvariables} ]] ; then
|
||||
echo "[ERROR] Required variable \"${buildvariables}\" is not set. Please check your build file."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -239,7 +236,7 @@ if ! echo "$homepage" | egrep -q '^http://|^https://|^ftp://' ; then
|
|||
fi
|
||||
|
||||
# Validate $download
|
||||
if [ -n "$download" ]; then
|
||||
if [[ -n $download ]]; then
|
||||
if ! echo "$download" | egrep -q '^http://|^https://|^ftp://' ; then
|
||||
echo "[ERROR] Invalid URL in the '"'download'"' variable in the build file."
|
||||
exit 1
|
||||
|
@ -248,13 +245,13 @@ fi
|
|||
|
||||
# Validate $desc
|
||||
#if [ "$(echo "$desc" | wc -c)" -gt 100 ] ; then
|
||||
if [ "${#desc}" -gt 100 ] ; then
|
||||
if [[ ${#desc} -gt 100 ]] ; then
|
||||
echo "[ERROR] Package description should not exceed 100 characters in the build file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if build() function exists in the build file
|
||||
if [[ ! "$(grep '^build()' "$buildfile")" ]] ; then
|
||||
if [[ ! "$(grep '^build()' $buildfile)" ]] ; then
|
||||
echo "[ERROR] build() function does not exist in your build file."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -264,8 +261,8 @@ echo "[INFO] Building package $app version $version ..."
|
|||
sleep 0.5
|
||||
|
||||
# Only verify source checksums if skipchecksum is not set in the build file
|
||||
if [ -z "$skipchecksum" ] ; then
|
||||
if [ -z "$sha512sums" ] ; then
|
||||
if [[ -z $skipchecksum ]] ; then
|
||||
if [[ -z $sha512sums ]] ; then
|
||||
echo "[ERROR] SHA512 checksums don't exist in $buildfile !"
|
||||
echo "[ERROR] Please run 'bldpkg -g' to add them"
|
||||
exit 1
|
||||
|
@ -287,7 +284,7 @@ fi
|
|||
# Function to output to the user which patch is about to be applied. Useful when
|
||||
# there are many patches and you want to determine which patch failed.
|
||||
applypatch() {
|
||||
if [ -z "$1" ]; then
|
||||
if [[ -z $1 ]]; then
|
||||
echo "[ERROR] Please provide valid patch file name"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -297,20 +294,20 @@ applypatch() {
|
|||
}
|
||||
|
||||
# Do a preliminary package dependency check if checkdependencies is set to 1 in bldpkg.conf
|
||||
if [ "$checkdependencies" = "1" ] ; then
|
||||
if [[ $checkdependencies = 1 ]] ; then
|
||||
|
||||
echo "[INFO] Parsing $app 's dependency list..."
|
||||
for packagedep in "$requires"; do
|
||||
depcount="$(find /share/doc -name $packagedep.SMBuild | wc -l)"
|
||||
# If count is 1, we are ok
|
||||
if [ "$depcount" = "1" ] ; then
|
||||
if [[ $depcount = 1 ]] ; then
|
||||
echo "[INFO] Found dependency $packagedep"
|
||||
# If count is 0, we exit, because we are in trouble
|
||||
elif [ "$depcount" = "0" ] ; then
|
||||
elif [[ $depcount = 0 ]] ; then
|
||||
echo "[ERROR] Did not find dependency $packagedep ."
|
||||
exit 1
|
||||
# If count is greater than or equal to 2, we are in slightly less trouble
|
||||
elif [ "$depcount" -ge "2" ] ; then
|
||||
elif [[ $depcount -ge 2 ]] ; then
|
||||
echo "[WARNING] Found multiple versions of $packagedep !"
|
||||
sleep 0.5
|
||||
fi
|
||||
|
@ -331,10 +328,10 @@ inarray() {
|
|||
}
|
||||
|
||||
# Check if $parenttmp is set and is a directory
|
||||
if [ -z "$parenttmp" ] ; then
|
||||
if [[ -z $parenttmp ]] ; then
|
||||
echo "[ERROR] parenttmp variable not set in /etc/bldpkg.conf."
|
||||
exit 1
|
||||
elif [ ! -d "$parenttmp" ] ; then
|
||||
elif [[ ! -d $parenttmp ]] ; then
|
||||
echo "[ERROR] parenttmp variable set to '"$tmpfsdir"' in /etc/bldpkg.conf is not a directory."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -346,7 +343,7 @@ if ! touch "$parenttmp"/.smlinuxwritetest ; then
|
|||
fi
|
||||
|
||||
# Discard the test file
|
||||
[ -e "$parenttmp"/.smlinuxwritetest ] && rm -f "$parenttmp"/.smlinuxwritetest
|
||||
[[ -e "$parenttmp"/.smlinuxwritetest ]] && rm -f "$parenttmp"/.smlinuxwritetest
|
||||
|
||||
# Determine if $tmpfsdir is listed inside $protecteddirectories array
|
||||
if inarray "${parenttmp}" "${protecteddirectories[@]}" ; then
|
||||
|
@ -358,9 +355,9 @@ fi
|
|||
# If $htmloutput is set to 1, echo $app, $version and $build as file names inside the parent build directory.
|
||||
# This will output into an HTML file so that the basic status of the build process (whether started, stopped,
|
||||
# interrupted or failed) can be viewed in the web browser.
|
||||
if [ "$htmloutput" = "1" ] ; then
|
||||
if [[ $htmloutput = 1 ]] ; then
|
||||
|
||||
if [ -n "$autobuild" ] ; then
|
||||
if [[ -n $autobuild ]] ; then
|
||||
cat << EOF >> $parenttmp/BUILDMONITOR
|
||||
<b>$commencedate | Building package # $currentpkgnumber / $totalpkgnumber: <i><a href="/smlinux/pkgresults?pkg=$app&smver=1.0&arch=all&resultnum=25">$app $version</a></i></b>
|
||||
EOF
|
||||
|
@ -405,18 +402,18 @@ fi
|
|||
|
||||
# Validate the TMPFS directory. If usetmpfs is set to 1 and tmpfsdir variable is set, then check for
|
||||
# genuineness of the TMPFS directory. If it fails, declare a variable for the build summary.
|
||||
if [ "$usetmpfs" = "1" ] && [ -n "$tmpfsdir" ]; then
|
||||
if [ ! -d "$tmpfsdir" ] || ! touch "$tmpfsdir/.smlinuxtmpwritetest" \
|
||||
|| [ "$(findmnt -no TARGET $tmpfsdir)" != "$tmpfsdir" ] \
|
||||
|| [ "$(findmnt -no FSTYPE $tmpfsdir)" != "tmpfs" ]; then
|
||||
if [[ $usetmpfs = 1 ]] && [[ -n $tmpfsdir ]]; then
|
||||
if [[ ! -d $tmpfsdir ]] || ! touch "$tmpfsdir/.smlinuxtmpwritetest" \
|
||||
|| [[ "$(findmnt -no TARGET $tmpfsdir)" != "$tmpfsdir" ]] \
|
||||
|| [[ "$(findmnt -no FSTYPE $tmpfsdir)" != "tmpfs" ]]; then
|
||||
tmpfscheckfailed=1
|
||||
fi
|
||||
|
||||
[ -e "$tmpfsdir/.smlinuxtmpwritetest" ] && rm -f "$tmpfsdir/.smlinuxtmpwritetest"
|
||||
[[ -e "$tmpfsdir/.smlinuxtmpwritetest" ]] && rm -f "$tmpfsdir/.smlinuxtmpwritetest"
|
||||
fi
|
||||
|
||||
# Validate system swap if swapcheck is defined and set to 1
|
||||
if [ "$swapcheck" = "1" ]; then
|
||||
if [[ $swapcheck = 1 ]]; then
|
||||
if inarray "${app}" "${packagesrequiringswap[@]}" ; then
|
||||
|
||||
# Here we determine available system swap size needed to compile exceptional packages that pull in a lot of RAM.
|
||||
|
@ -425,7 +422,7 @@ if [ "$swapcheck" = "1" ]; then
|
|||
#If it's less than swapsize, we exit with a status 1.
|
||||
|
||||
swapcheck="$(grep "SwapFree" /proc/meminfo | awk '{print $2}')"
|
||||
if [ "$swapcheck" -lt "$swapsize" ]; then
|
||||
if [[ $swapcheck -lt $swapsize ]]; then
|
||||
echo "[ERROR] Insufficient swap to build '"$app"' which is listed"
|
||||
echo "[ERROR] in $packagesrequiringswap. Kindly add/increase"
|
||||
echo "[ERROR] swap size on this system and try again."
|
||||
|
@ -439,7 +436,7 @@ fi
|
|||
|
||||
# If usetmpfs is set to 1, tmpfsdir is defined and tmpfscheckfailed variable is unset, determine if the
|
||||
# $app is in the exception list and whether to build inside or outside the TMPFS directory.
|
||||
if [ "$usetmpfs" = "1" ] && [ -n "$tmpfsdir" ] && [ -z "$tmpfscheckfailed" ] ; then
|
||||
if [[ $usetmpfs = 1 ]] && [[ -n $tmpfsdir ]] && [[ -z $tmpfscheckfailed ]] ; then
|
||||
|
||||
# If $app is in the TMPFS exception list inside /etc/bldpkg.conf, compile it *OUTSIDE* the TMPFS directory, i.e
|
||||
# the non-TMPFS directory, else compile it *INSIDE* the TMPFS directory. This if/else is solely for deciding
|
||||
|
@ -475,7 +472,7 @@ else
|
|||
fi
|
||||
|
||||
# Validate and export $cputhreads as MAKEFLAGS variable
|
||||
if [ -n "$cputhreads" ]; then
|
||||
if [[ -n $cputhreads ]]; then
|
||||
# export the user-defined number
|
||||
MAKEFLAGS="$cputhreads"
|
||||
export MAKEFLAGS
|
||||
|
@ -487,9 +484,9 @@ fi
|
|||
|
||||
# Validate all compilers
|
||||
# Validate everything related to distcc if globaldistcc is set
|
||||
if [ "$globaldistcc" = "1" ] ; then
|
||||
if [[ $globaldistcc = 1 ]] ; then
|
||||
# Check if distcc exists and is an executable
|
||||
if [ ! -x "$distccbinpath" ]; then
|
||||
if [[ ! -x $distccbinpath ]]; then
|
||||
echo "[ERROR] Oops! Distcc binary was not found but building with it"
|
||||
echo "[ERROR] was requested! Either ensure distcc is in your "'$PATH'" or"
|
||||
echo "[ERROR] disable this option in bldpkg.conf file."
|
||||
|
@ -497,10 +494,10 @@ if [ "$globaldistcc" = "1" ] ; then
|
|||
fi
|
||||
|
||||
# Check if the symlinks are right
|
||||
if [ ! "$(echo "$PATH" | grep "$distccsympath")" ] ; then
|
||||
if [[ ! "$(echo "$PATH" | grep "$distccsympath")" ]] ; then
|
||||
echo "[ERROR] $distccsympath not found in "'$PATH'"! Fix it please."
|
||||
exit 1
|
||||
elif [ ! -d "$distccsympath" ] ; then
|
||||
elif [[ ! -d $distccsympath ]] ; then
|
||||
echo "[ERROR] $distccsympath directory containing symlinks to distcc"
|
||||
echo "[ERROR] does not exist! Kindly create it and create symlinks"
|
||||
echo "[ERROR] based on instructions in bldpkg.conf!"
|
||||
|
@ -509,9 +506,9 @@ if [ "$globaldistcc" = "1" ] ; then
|
|||
|
||||
# Trace symlinks to the binary
|
||||
for f in gcc g++ cc c++ ; do
|
||||
if [ -e "$distccsympath/$f" ] && [ -L "$distccsympath/$f" ]; then
|
||||
if [[ -e $distccsympath/$f ]] && [[ -L $distccsympath/$f ]]; then
|
||||
# We use "realpath" to follow the $distccsympath/$f symlink and act on the exit code.
|
||||
if [ "$(realpath -e "$distccsympath/$f")" != "$distccbinpath" ] ; then
|
||||
if [[ "$(realpath -e $distccsympath/$f)" != $distccbinpath ]] ; then
|
||||
echo "[ERROR] $distccsympath/$f does not point to $distccbinpath. "
|
||||
echo "[ERROR] Kindly fix this!"
|
||||
exit 1
|
||||
|
@ -538,7 +535,7 @@ if [ "$globaldistcc" = "1" ] ; then
|
|||
#checkstatus="$?"
|
||||
|
||||
# Discard the files once the validation passes/fails
|
||||
#if [ "$checkstatus" = "0" ] ; then
|
||||
#if [[ $checkstatus = 0 ]] ; then
|
||||
# echo "[OK]"
|
||||
# rm $parenttmp/distcccheck-"$f"{,.c}
|
||||
#else
|
||||
|
@ -551,7 +548,7 @@ if [ "$globaldistcc" = "1" ] ; then
|
|||
|
||||
# If distcc=0 is set in the package build file to disable distcc, remove the value of $distccsympath from
|
||||
# $PATH otherwise export DISTCC_HOSTS and DISTCC_IO_TIMEOUT variables.
|
||||
if [ "$distcc" = "0" ] ; then
|
||||
if [[ $distcc = 0 ]] ; then
|
||||
PATH="$(echo "$PATH" | sed "s@:$distccsympath@@g")"
|
||||
export PATH
|
||||
else
|
||||
|
@ -564,18 +561,18 @@ else
|
|||
fi
|
||||
|
||||
# Validate everything related to ccache if globalccache is set
|
||||
if [ "$globalccache" = "1" ]; then
|
||||
if [ ! -x "$ccachebinpath" ] ; then
|
||||
if [[ $globalccache = 1 ]]; then
|
||||
if [[ ! -x $ccachebinpath ]] ; then
|
||||
echo "[ERROR] Oops! ccache binary was not found but building with it"
|
||||
echo "[ERROR] was requested! Either ensure ccache is in your "'$PATH'" or"
|
||||
echo "[ERROR] disable this option in bldpkg.conf."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! "$(echo $PATH | grep "$ccachesympath")" ] ; then
|
||||
if [[ ! "$(echo $PATH | grep $ccachesympath)" ]] ; then
|
||||
echo "[ERROR] $ccachesympath not found in "'$PATH!'" Fix it please."
|
||||
exit 1
|
||||
elif [ ! -d "$ccachesympath" ] ; then
|
||||
elif [[ ! -d $ccachesympath ]] ; then
|
||||
echo "[ERROR] $ccachesympath directory containing symlinks to ccache"
|
||||
echo "[ERROR] does not exist! Kindly create it and create symlinks"
|
||||
echo "[ERROR] based on instructions in bldpkg.conf."
|
||||
|
@ -583,9 +580,9 @@ if [ "$globalccache" = "1" ]; then
|
|||
fi
|
||||
|
||||
for f in gcc g++ cc c++ ; do
|
||||
if [ -e "$ccachesympath/$f" ] && [ -L "$ccachesympath/$f" ]; then
|
||||
if [[ -e $ccachesympath/$f ]] && [[ -L $ccachesympath/$f ]]; then
|
||||
# We use "realpath" to follow the $ccachesympath/$f symlink and act on the exit code
|
||||
if [ "$(realpath -e "$ccachesympath/$f")" != "$ccachebinpath" ] ; then
|
||||
if [[ "$(realpath -e $ccachesympath/$f)" != $ccachebinpath ]] ; then
|
||||
echo "[ERROR] $ccachesympath/$f does not point to $ccachebinpath. "
|
||||
echo "[ERROR] Kindly fix this!"
|
||||
exit 1
|
||||
|
@ -612,7 +609,7 @@ if [ "$globalccache" = "1" ]; then
|
|||
#checkstatus="$?"
|
||||
|
||||
# Discard the files once the validation passes/fails
|
||||
#if [ "$checkstatus" = "0" ] ; then
|
||||
#if [[ $checkstatus = 0 ]] ; then
|
||||
# echo "[OK]"
|
||||
# rm $parenttmp/ccachecheck-"$f"{,.c}
|
||||
#else
|
||||
|
@ -625,7 +622,7 @@ if [ "$globalccache" = "1" ]; then
|
|||
|
||||
# If ccache=0 is set in the package build file to disable ccache, remove the value of ccachesympath
|
||||
# from $PATH and export it again
|
||||
if [ "$ccache" = "0" ]; then
|
||||
if [[ $ccache = 0 ]]; then
|
||||
PATH="$(echo "$PATH" | sed "s@$ccachesympath:@@g")"
|
||||
export PATH
|
||||
fi
|
||||
|
@ -636,18 +633,18 @@ else
|
|||
fi
|
||||
|
||||
# Validate everything related to sccache if globalccache is set
|
||||
if [ "$globalsccache" = "1" ]; then
|
||||
if [ ! -x "$sccachebinpath" ] ; then
|
||||
if [[ $globalsccache = 1 ]]; then
|
||||
if [[ ! -x $sccachebinpath ]] ; then
|
||||
echo "[ERROR] Oops! sccache binary was not found but building with it"
|
||||
echo "[ERROR] was requested! Either ensure sccache is in your "'$PATH'" or"
|
||||
echo "[ERROR] disable this option in bldpkg.conf."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! "$(echo "$PATH" | grep "$sccachepath")" ] ; then
|
||||
if [[ ! "$(echo $PATH | grep $sccachepath)" ]] ; then
|
||||
echo "[ERROR] $sccachepath not found in "'$PATH!'" Fix it please."
|
||||
exit 1
|
||||
elif [ ! -d "$sccachepath" ] ; then
|
||||
elif [[ ! -d $sccachepath ]] ; then
|
||||
echo "[ERROR] $sccachepath directory containing symlinks to ccache"
|
||||
echo "[ERROR] does not exist! Kindly create it and create symlinks"
|
||||
echo "[ERROR] based on instructions in bldpkg.conf."
|
||||
|
@ -662,12 +659,12 @@ if [ "$globalsccache" = "1" ]; then
|
|||
# Then get the inode number of the file inside the hard link path
|
||||
sccache_hardlink_file_inode_num="$(stat --printf '%i\n' $sccachepath/$f)"
|
||||
|
||||
if [ ! -e "$sccachepath/$f" ] ; then
|
||||
if [[ ! -e $sccachepath/$f ]] ; then
|
||||
echo "[ERROR] $f either does not exist inside $sccachepath"
|
||||
echo "[ERROR] Kindly fix this!"
|
||||
exit 1
|
||||
# If the hard link's inode number does not match the original binary's inode number, throw an error and exit
|
||||
elif [ "$sccache_hardlink_file_inode_num" != "$sccache_binary_inode_num" ] ; then
|
||||
elif [[ $sccache_hardlink_file_inode_num != $sccache_binary_inode_num ]] ; then
|
||||
echo "[ERROR] File '"$f"' inside $sccachepath is not a hard link!"
|
||||
echo "[ERROR] Kindly fix this!"
|
||||
exit 1
|
||||
|
@ -689,7 +686,7 @@ if [ "$globalsccache" = "1" ]; then
|
|||
#checkstatus="$?"
|
||||
|
||||
# Discard the files once the validation passes/fails
|
||||
#if [ "$checkstatus" = "0" ] ; then
|
||||
#if [[ $checkstatus = 0 ]] ; then
|
||||
# echo "[OK]"
|
||||
# rm $parenttmp/sccachecheck-"$f"{,.c}
|
||||
#else
|
||||
|
@ -706,7 +703,7 @@ if [ "$globalsccache" = "1" ]; then
|
|||
|
||||
# If sccache=0 is set in the package build file to disable sccache, remove the value of sccachepath
|
||||
# from $PATH and export it again
|
||||
if [ "$sccache" = "0" ]; then
|
||||
if [[ $sccache = 0 ]]; then
|
||||
PATH="$(echo "$PATH" | sed "s@$sccachepath:@@g")"
|
||||
export PATH
|
||||
fi
|
||||
|
@ -723,17 +720,17 @@ fi
|
|||
|
||||
# If $arch has not been exported by autobuild or not set in the individual build files that have arch=noarch, we set our own
|
||||
# $HOSTTYPE is only set in the bash shell.
|
||||
[ -z "$arch" ] && arch="$HOSTTYPE"
|
||||
[[ -z $arch ]] && arch="$HOSTTYPE"
|
||||
|
||||
if [ "$arch" = "noarch" ]; then
|
||||
if [[ $arch = noarch ]]; then
|
||||
CFLAGS=""
|
||||
export CFLAGS
|
||||
|
||||
elif [ "$arch" = "aarch64" ]; then
|
||||
elif [[ $arch = aarch64 ]]; then
|
||||
hostdist="$aarch64hostdist"
|
||||
builddist="$aarch64builddist"
|
||||
|
||||
if [ -n "$debug" ]; then
|
||||
if [[ -n $debug ]]; then
|
||||
CFLAGS="$(echo $gccdebug $aarch64cflags)"
|
||||
else
|
||||
CFLAGS="$aarch64cflags"
|
||||
|
@ -742,10 +739,10 @@ elif [ "$arch" = "aarch64" ]; then
|
|||
CXXFLAGS="$CFLAGS"
|
||||
export hostdist builddist CFLAGS CXXFLAGS
|
||||
|
||||
elif [ "$arch" = "x86_64" ]; then
|
||||
elif [[ $arch = x86_64 ]]; then
|
||||
builddist="$x8664builddist"
|
||||
|
||||
if [ -n "$debug" ]; then
|
||||
if [[ -n $debug ]]; then
|
||||
CFLAGS="$(echo $gccdebug $x8664cflags)"
|
||||
else
|
||||
CFLAGS="$x8664cflags"
|
||||
|
@ -763,15 +760,15 @@ fi
|
|||
# If $noautoconfsite is unset in an individual package build file, export CONFIG_SITE variable into the build
|
||||
# environment for a package's configure script to pickup. Most autoconf-compatible configure scripts will
|
||||
# automatically pick up this variable from the environment and speed up the initial configure process.
|
||||
if [ -z "$noautoconfsite" ] ; then
|
||||
if [ -n "$configsite" ] && [ -e "$configsite" ]; then
|
||||
if [[ -z $noautoconfsite ]] ; then
|
||||
if [[ -n $configsite ]] && [[ -e $configsite ]]; then
|
||||
CONFIG_SITE="$configsite"
|
||||
export CONFIG_SITE
|
||||
fi
|
||||
fi
|
||||
|
||||
# Condition to reuse the autobuildtemp file if set from autobuild or make a new temporary file
|
||||
if [ -n "$autobuildtemp" ]; then
|
||||
if [[ -n $autobuildtemp ]]; then
|
||||
tempfile="$autobuildtemp"
|
||||
else
|
||||
tempfile="$(mktemp $parenttmp/SMBUILD.XXXXXX)"
|
||||
|
@ -784,7 +781,7 @@ compileonlyfor() {
|
|||
archname="$(uname -m)"
|
||||
archargument=$1
|
||||
|
||||
if [ "$archname" != "$archargument" ]; then
|
||||
if [[ $archname != $archargument ]]; then
|
||||
echo ""
|
||||
echo "[INFO] '"$app"' not supported on '"$archname"' and hence not"
|
||||
echo "[INFO] not being built. Exiting."
|
||||
|
@ -821,14 +818,14 @@ fixbuilddirpermissions() {
|
|||
# Function to calculate elapsed build time. runtime takes the $SECONDS variable as an argument. $SECONDS is an
|
||||
# environment variable set by bash to show the number of whole seconds the shell has been running.
|
||||
runtime() {
|
||||
[ -z "$1" ] && return 1
|
||||
[[ -z $1 ]] && return 1
|
||||
|
||||
local D=$(( $1 / 86400 ))
|
||||
local H=$(( ($1 - ($D * 86400)) / 3600 ))
|
||||
local M=$(( ($1 - ($D * 86400) - ($H * 3600)) / 60 ))
|
||||
local S=$(( $1 - ($D * 86400) - ($H * 3600) - ($M * 60) ))
|
||||
|
||||
if [ "$D" -gt "0" ]; then
|
||||
if [[ $D -gt 0 ]]; then
|
||||
echo -n "${D}d, ${H}h ${M}m ${S}s"
|
||||
else
|
||||
echo -n "${H}h, ${M}m ${S}s"
|
||||
|
@ -857,7 +854,7 @@ preprunitservice() {
|
|||
mkdir -p "etc/service/$1" var/service
|
||||
|
||||
# Copy the service run file from the source directory into etc/service/$1
|
||||
if [ -f "$srcdir/$1.run" ] ; then
|
||||
if [[ -f $srcdir/$1.run ]] ; then
|
||||
cp "$srcdir/$1.run" "etc/service/$1/run"
|
||||
else
|
||||
echo "[ERROR] $1.run does not exist!"
|
||||
|
@ -865,14 +862,14 @@ preprunitservice() {
|
|||
fi
|
||||
|
||||
# If the second argument is "down", or if the second argument is "finish", create that file inside etc/service/$1/
|
||||
if [ "$2" = "down" ]; then
|
||||
if [[ $2 = down ]]; then
|
||||
touch "etc/service/$1/down"
|
||||
elif [ "$2" = "finish" ]; then
|
||||
elif [[ $2 = finish ]]; then
|
||||
cp "$srcdir/$1.$2" "etc/service/$1/finish"
|
||||
fi
|
||||
|
||||
# If the third argument is "finish", copy that file from the source directory into etc/service/$1/
|
||||
[ -n "$3" ] && cp "$srcdir/$1.$3" "etc/service/$1/finish"
|
||||
[[ -n $3 ]] && cp "$srcdir/$1.$3" "etc/service/$1/finish"
|
||||
|
||||
# Create the symlinks between etc/service and var/service
|
||||
ln -s "../../etc/service/$1" "var/service/$1"
|
||||
|
@ -909,7 +906,7 @@ mkfinalpkg() {
|
|||
echo "[INFO] Just a min..."
|
||||
|
||||
# Check if /lib64 was created inside $pkg
|
||||
if [ -d "$pkg/lib64" ] ; then
|
||||
if [[ -d $pkg/lib64 ]] ; then
|
||||
echo "[ERROR] $app has /lib64 directory. Musl does not support multilib."
|
||||
echo "[ERROR] Please fix the build options and ensure the /lib64 is not created."
|
||||
exit 1
|
||||
|
@ -917,7 +914,7 @@ mkfinalpkg() {
|
|||
|
||||
# Check if /usr and /sbin were created inside $pkg
|
||||
for directory in usr sbin ; do
|
||||
if [ -d "$pkg/$directory" ] ; then
|
||||
if [[ -d $pkg/$directory ]] ; then
|
||||
echo "[ERROR] $app has $directory directory which is a symlink to /bin on SMLinux."
|
||||
echo "[ERROR] Please fix the build options and ensure $directory is not created."
|
||||
exit 1
|
||||
|
@ -927,26 +924,26 @@ mkfinalpkg() {
|
|||
echo "[INFO] Copying post-install files..."
|
||||
mkdir -p "$pkg/install"
|
||||
|
||||
[ -e "$srcdir/doinst.sh" ] && cp "$srcdir/doinst.sh" "$pkg/install/"
|
||||
[[ -e $srcdir/doinst.sh ]] && cp "$srcdir/doinst.sh" "$pkg/install/"
|
||||
|
||||
# If /share/applications directory exists but there is no doinst.sh in the source directory, create one using cat
|
||||
if [ -d "$pkg/share/applications" ] && [ ! -e "$srcdir/doinst.sh" ] ; then
|
||||
if [[ -d "$pkg/share/applications" ]] && [[ ! -e "$srcdir/doinst.sh" ]] ; then
|
||||
echo "[INFO] Found /share/applications but couldn't find any doinst.sh in the source directory."
|
||||
echo "[INFO] Creating one automatically that refreshes GTK cache."
|
||||
cat << EOF >> $pkg/install/doinst.sh
|
||||
[ -x /etc/rc.d/rc.gtk ] && /etc/rc.d/rc.gtk
|
||||
[[ -x /etc/rc.d/rc.gtk ]] && /etc/rc.d/rc.gtk
|
||||
EOF
|
||||
|
||||
elif [ -d "$pkg/share/applications" ] && [ -e "$srcdir/doinst.sh" ] && ! grep -q 'rc.gtk' "$srcdir/doinst.sh" ; then
|
||||
elif [[ -d "$pkg/share/applications" ]] && [[ -e "$srcdir/doinst.sh" ]] && ! grep -q 'rc.gtk' "$srcdir/doinst.sh" ; then
|
||||
echo "[INFO] Found /share/applications but couldn't find any rc.gtk lines inside doinst.sh in the source directory."
|
||||
echo "[INFO] Creating one automatically that refreshes GTK cache."
|
||||
cat << EOF >> $pkg/install/doinst.sh
|
||||
[ -x /etc/rc.d/rc.gtk ] && /etc/rc.d/rc.gtk
|
||||
[[ -x /etc/rc.d/rc.gtk ]] && /etc/rc.d/rc.gtk
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Compress and link manpages
|
||||
if [ -d "$pkg/share/man" ]; then
|
||||
if [[ -d "$pkg/share/man" ]]; then
|
||||
echo "[INFO] Compressing and linking man pages..."
|
||||
(
|
||||
cd "$pkg/share/man"
|
||||
|
@ -968,7 +965,7 @@ EOF
|
|||
# Normally we'd expect some debug symbols in the newly-produced binaries.
|
||||
# But that isn't always the case with some packages whose build systems
|
||||
# strip objects before hand
|
||||
if [ "$debug" = "1" ] ; then
|
||||
if [[ $debug = 1 ]] ; then
|
||||
for file in \
|
||||
$( find $pkg )
|
||||
do
|
||||
|
@ -978,7 +975,7 @@ EOF
|
|||
done
|
||||
|
||||
debugfilecount="$(wc -l < "$pkg/install/package.$app.debugfailedfilenames")"
|
||||
if [ "$debugfilecount" -ge "1" ]; then
|
||||
if [[ $debugfilecount -ge 1 ]]; then
|
||||
debugwarning=1
|
||||
else
|
||||
rm "$pkg/install/package.$app.debugfailedfilenames"
|
||||
|
@ -986,7 +983,7 @@ EOF
|
|||
fi
|
||||
|
||||
# Now strip the binaries and shared libraries. --strip-unneeded is unnecessary for binutils 2.34+
|
||||
if [ -z "$debug" ] && [ "$debug" != "1" ]; then
|
||||
if [[ -z $debug ]] && [[ $debug != 1 ]]; then
|
||||
find "$pkg" -print0 | xargs -0 file -m /etc/file/magic/elf | \
|
||||
grep -E "executable|shared object|statically linked" | grep "ELF" | \
|
||||
cut -d: -f1 | xargs strip 2>/dev/null || true
|
||||
|
@ -998,7 +995,7 @@ EOF
|
|||
xargs strip 2>/dev/null || true
|
||||
|
||||
# Calculate total files, directories, symlinks and uncompressed staging directory size
|
||||
if [ "$showsummary" = "1" ] ; then
|
||||
if [[ $showsummary = 1 ]] ; then
|
||||
totalfilecount="$(find $pkg -type f | wc -l)"
|
||||
totaldircount="$(find $pkg -type d | wc -l)"
|
||||
totalsymcount="$(find $pkg -type l | wc -l)"
|
||||
|
@ -1024,7 +1021,7 @@ EOF
|
|||
cd "$srcdir"
|
||||
|
||||
|
||||
if [ "$showsummary" = "1" ] || [ "$htmloutput" = "1" ] ; then
|
||||
if [[ $showsummary = 1 ]] || [[ $htmloutput = 1 ]] ; then
|
||||
# With SECONDS reset, the shell will add in a fresh value, which we can now use to ascertain the packaging time,
|
||||
# by again passing that value as an argument to the runtime function
|
||||
packagetimea="$SECONDS"
|
||||
|
@ -1032,14 +1029,14 @@ EOF
|
|||
fi
|
||||
|
||||
|
||||
if [ "$showsummary" = "1" ]; then
|
||||
if [[ $showsummary = 1 ]]; then
|
||||
# Determine size of SRCDIR aka source directory
|
||||
srcdirsize="$(du -s $srcdir | awk '{print $1}')"
|
||||
# Determine size of tmp aka build directory size
|
||||
builddirsize="$(du -s $tmp | awk '{print $1}')"
|
||||
|
||||
# Calculate SSD write savings if TMPFS has been used
|
||||
if [ "$usetmpfs" = "1" ] && [ "$tmpfsenabledforthispackage" = "1" ] ; then
|
||||
if [[ $usetmpfs = 1 ]] && [[ $tmpfsenabledforthispackage = 1 ]] ; then
|
||||
|
||||
# Determine size of staging directory
|
||||
pkgdirsize="$(du -s $pkg | awk '{print $1}')"
|
||||
|
@ -1056,14 +1053,14 @@ EOF
|
|||
fi
|
||||
|
||||
# Delete the build directory if preservebuilddir is set to 0
|
||||
if [ "$preservebuilddir" = "0" ] ; then
|
||||
if [[ $preservebuilddir = 0 ]] ; then
|
||||
if ! inarray "${tmp}" "${protecteddirectories[@]}" ; then
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Delete the package build directory if preservepackagedir is set to 0
|
||||
if [ "$preservepackagedir" = "0" ] ; then
|
||||
if [[ $preservepackagedir = 0 ]] ; then
|
||||
if ! inarray "${pkg}" "${protecteddirectories[@]}" ; then
|
||||
rm -rf "$pkg"
|
||||
fi
|
||||
|
@ -1084,7 +1081,7 @@ prepbuildoutput() {
|
|||
# If compiletimea is set, then do a sum total of compiletimea and packagetimea variables to get the
|
||||
# total time in seconds and use that as an argument for the runtime function. If compiletimea is not set,
|
||||
# invoke the runtime function alone on new reset $SECONDS
|
||||
if [ -n "$compiletimea" ] && [ "$pkgstatus" = "0" ] ; then
|
||||
if [[ -n $compiletimea ]] && [[ $pkgstatus = 0 ]] ; then
|
||||
finalcompiletime="$(( $compiletimea + $packagetimea ))"
|
||||
totaltime="$( runtime $finalcompiletime )"
|
||||
else
|
||||
|
@ -1092,12 +1089,12 @@ prepbuildoutput() {
|
|||
fi
|
||||
|
||||
# Start of the showsummary if/else check
|
||||
if [ "$showsummary" = "1" ]; then
|
||||
if [[ $showsummary = 1 ]]; then
|
||||
|
||||
# Stick to 8/16 colours, those are supported on most terminals
|
||||
if [ "$colours" = "1" ]; then
|
||||
if [[ $colours = 1 ]]; then
|
||||
colourscheck="$(tput colors 2>/dev/null)"
|
||||
if [ "$?" = "0" ] && [ "$colourscheck" -gt "2" ] ; then
|
||||
if [[ "$?" = 0 ]] && [[ $colourscheck -gt 2 ]] ; then
|
||||
# Red when the build fails
|
||||
colourr="\e[41m"
|
||||
# Yellow when the build is interrupted
|
||||
|
@ -1114,7 +1111,7 @@ prepbuildoutput() {
|
|||
fi
|
||||
|
||||
# Determine the build type
|
||||
if [ -n "$autobuild" ]; then
|
||||
if [[ -n $autobuild ]]; then
|
||||
# We are using Tadgy's autobuild system
|
||||
buildsys="SSB Autobuild"
|
||||
else
|
||||
|
@ -1125,14 +1122,14 @@ prepbuildoutput() {
|
|||
|
||||
# Determine if distcc was used. If globaldistcc is enabled and set to 1 and distcc is not declared in the
|
||||
# package build file, then set dstats in the build summary
|
||||
if [ "$globaldistcc" = "1" ] && [ -z "$distcc" ]; then
|
||||
if [[ $globaldistcc = 1 ]] && [[ -z $distcc ]]; then
|
||||
dstats="Yes"
|
||||
# Else if globaldistcc is enabled and set to 1 and distcc is set to 0 in the package build file, then set
|
||||
# dstats in the build summary
|
||||
elif [ "$globaldistcc" = "1" ] && [ "$distcc" = "0" ]; then
|
||||
elif [[ $globaldistcc = 1 ]] && [[ $distcc = 0 ]]; then
|
||||
dstats="Nope, disabled but global variable set"
|
||||
# Else If globaldistcc is unset, set dstats in the build summary
|
||||
elif [ -z "$globaldistcc" ] || [ "$globaldistcc" = "0" ]; then
|
||||
elif [[ -z $globaldistcc ]] || [[ $globaldistcc = 0 ]]; then
|
||||
dstats="No, disabled globally"
|
||||
fi
|
||||
|
||||
|
@ -1140,24 +1137,24 @@ prepbuildoutput() {
|
|||
# Determine if ccache was used. Ccache caches compiler objects to disk, which speeds up subsequent compiles.
|
||||
# However, if we are compiling inside tmpfs, we are not using ccache at all. So we set cstats accordingly
|
||||
# in the build summary
|
||||
if [ "$globalccache" = "1" ] && [ "$usetmpfs" = "1" ] && [ "$tmpfsenabledforthispackage" = "1" ] ; then
|
||||
if [[ $globalccache = 1 ]] && [[ $usetmpfs = 1 ]] && [[ $tmpfsenabledforthispackage = 1 ]] ; then
|
||||
cstats="Enabled globally but disabled due to tmpfs"
|
||||
|
||||
elif [ "$globalccache" = "1" ] && [ -n "$usetmpfs" ] && [ "$usetmpfs" = "0" ] ; then
|
||||
elif [[ $globalccache = 1 ]] && [[ -n $usetmpfs ]] && [[ $usetmpfs = 0 ]] ; then
|
||||
cstats="Yes"
|
||||
|
||||
elif [ "$globalccache" = "1" ] && [ -z "$usetmpfs" ] ; then
|
||||
elif [[ $globalccache = 1 ]] && [[ -z $usetmpfs ]] ; then
|
||||
cstats="Yes"
|
||||
|
||||
elif [ -z "$globalccache" ] || [ "$globalccache" = "0" ] ; then
|
||||
elif [[ -z $globalccache ]] || [[ $globalccache = 0 ]] ; then
|
||||
cstats="No, disabled globally"
|
||||
fi
|
||||
|
||||
|
||||
# Determine the build type
|
||||
if [ "$debug" = "1" ] && [ -z "$debugwarning" ] ; then
|
||||
if [[ $debug = 1 ]] && [[ -z $debugwarning ]] ; then
|
||||
bldtype="*DEBUG* build"
|
||||
elif [ "$debug" = "1" ] && [ "$debugwarning" = "1" ]; then
|
||||
elif [[ $debug = 1 ]] && [[ $debugwarning = 1 ]]; then
|
||||
bldtype="*DEBUG* build[WARNING]"
|
||||
else
|
||||
bldtype="General build, no debug symbols"
|
||||
|
@ -1165,13 +1162,13 @@ prepbuildoutput() {
|
|||
|
||||
|
||||
# Determine whether tmpfs was used
|
||||
if [ "$usetmpfs" = "1" ] && [ "$tmpfsenabledforthispackage" = "1" ] ; then
|
||||
if [[ $usetmpfs = 1 ]] && [[ $tmpfsenabledforthispackage = 1 ]] ; then
|
||||
tmpfsstate="Yes"
|
||||
|
||||
elif [ "$usetmpfs" = "1" ] && [ "$tmpfsenabledforthispackage" = "0" ]; then
|
||||
elif [[ $usetmpfs = 1 ]] && [[ $tmpfsenabledforthispackage = 0 ]]; then
|
||||
tmpfsstate="*Not for this package* but enabled globally"
|
||||
|
||||
elif [ "$usetmpfs" = "1" ] && [ "$tmpfscheckfailed" = "1" ]; then
|
||||
elif [[ $usetmpfs = 1 ]] && [[ $tmpfscheckfailed = 1 ]]; then
|
||||
tmpfsstate="*NOPE, TMPFS DIRECTORY CHECK FAILED* but enabled globally"
|
||||
|
||||
else
|
||||
|
@ -1179,14 +1176,14 @@ prepbuildoutput() {
|
|||
fi
|
||||
|
||||
|
||||
if [ -n "$cputhreads" ]; then
|
||||
if [[ -n $cputhreads ]]; then
|
||||
makeflags="$MAKEFLAGS, manually set"
|
||||
else
|
||||
makeflags="$MAKEFLAGS, auto-detected"
|
||||
fi
|
||||
|
||||
# Determine if the build was successful or not
|
||||
if [ "$pkgstatus" = "0" ] ; then
|
||||
if [[ $pkgstatus = 0 ]] ; then
|
||||
bldstatus="$(echo -e "$colourg"'Successful! :-D' "$colourd")"
|
||||
|
||||
# Determine the compressed size
|
||||
|
@ -1195,7 +1192,7 @@ prepbuildoutput() {
|
|||
# Determine the uncompressed size
|
||||
packusize="$(echo $packusize1)"
|
||||
|
||||
elif [ "$wasinterrupted" = "1" ]; then
|
||||
elif [[ $wasinterrupted = 1 ]]; then
|
||||
bldstatus="$(echo -e "$coloury"'** INTERRUPTED ** :-/'"$colourd")"
|
||||
|
||||
else
|
||||
|
@ -1217,15 +1214,15 @@ prepbuildoutput() {
|
|||
|
||||
|
||||
# Output the section name if autobuildtemp is set. This means we are running an autobuild.
|
||||
if [ -n "$autobuildtemp" ]; then
|
||||
if [[ -n $autobuildtemp ]]; then
|
||||
echo -e ""$colourc" Build Section:"$colourd" $SECTION" >> "$tempfile"
|
||||
fi
|
||||
|
||||
|
||||
# If we have $compiletimeb set, then assume the compile went well and output compile and packaging times into tempfile.
|
||||
if [ -n "$totaltime" ] && [ -z "$packagetimeb" ]; then
|
||||
if [[ -n $totaltime ]] && [[ -z $packagetimeb ]]; then
|
||||
echo -e ""$colourc" Total Time: "$colourd" $totaltime" >> "$tempfile"
|
||||
elif [ -n "$totaltime" ] && [ -n "$packagetimeb" ]; then
|
||||
elif [[ -n $totaltime ]] && [[ -n $packagetimeb ]]; then
|
||||
echo -e ""$colourc" Total Time: "$colourd" $totaltime ( $compiletimeb Compile ) + ( $packagetimeb Packaging )" >> "$tempfile"
|
||||
fi
|
||||
|
||||
|
@ -1234,7 +1231,7 @@ prepbuildoutput() {
|
|||
echo -e ""$colourc" Stopped:"$colourd" $finishdate" >> "$tempfile"
|
||||
|
||||
# If the package was built successfully, output the installer sizes
|
||||
if [ "$pkgstatus" = "0" ]; then
|
||||
if [[ $pkgstatus = 0 ]]; then
|
||||
|
||||
#compressedsize="$(echo $(($packsize * 100 / $packusize)))"
|
||||
# Space saving = 1 - Compressed Size / Uncompressed size.
|
||||
|
@ -1252,7 +1249,7 @@ prepbuildoutput() {
|
|||
|
||||
|
||||
# If ccache was used, output the current cache used size and max allocated size
|
||||
if [ "$globalccache" = "1" ] && [ "$ccache" != "0" ] && [ "$cstats" = "Yes" ]; then
|
||||
if [[ $globalccache = 1 ]] && [[ $ccache != 0 ]] && [[ $cstats = Yes ]]; then
|
||||
ccacheusedsize="$(ccache -s | grep "cache size" | head -n 1 | \
|
||||
awk '{ $1=$2="" ; print $0}')"
|
||||
ccachetotalsize="$(ccache -s | grep "max cache size" | \
|
||||
|
@ -1269,7 +1266,7 @@ prepbuildoutput() {
|
|||
|
||||
|
||||
# If distcc was used, cut out --randomize and output rest of the DISTCC_HOSTS variable
|
||||
if [ "$globaldistcc" = "1" ] && [ "$distcc" != "0" ]; then
|
||||
if [[ $globaldistcc = 1 ]] && [[ $distcc != 0 ]]; then
|
||||
echo -e ""$colourc" Distcc Args: "$colourd" $(echo "$DISTCC_HOSTS" | sed 's@--randomize@@')" >> "$tempfile"
|
||||
fi
|
||||
|
||||
|
@ -1305,12 +1302,12 @@ prepbuildoutput() {
|
|||
}
|
||||
|
||||
prephtmloutput() {
|
||||
if [ "$htmloutput" = "1" ] ; then
|
||||
if [ "$pkgstatus" = "0" ] ; then
|
||||
if [[ $htmloutput = 1 ]] ; then
|
||||
if [[ $pkgstatus = 0 ]] ; then
|
||||
cat << EOF >> $parenttmp/BUILDMONITOR.html
|
||||
<tr><td><b><i><a href="/smlinux/pkgresults?pkg=$app&smver=1.0&arch=all&resultnum=25">$app $version</a></i></b></td><td>$commencedate</td><td>$finishdate</td><td>$totaltime</td><td><b style="color:#00cc00;">SUCCEEDED</b></td></tr>
|
||||
EOF
|
||||
elif [ "$wasinterrupted" = "1" ]; then
|
||||
elif [[ $wasinterrupted = 1 ]]; then
|
||||
cat << EOF >> $parenttmp/BUILDMONITOR.html
|
||||
<tr><td><b><i><a href="/smlinux/pkgresults?pkg=$app&smver=1.0&arch=all&resultnum=25">$app $version</a></i></b></td><td>$commencedate</td><td>$finishdate</td><td>$totaltime</td><td><b>INTERRUPTED</b></td></tr>
|
||||
EOF
|
||||
|
@ -1325,7 +1322,7 @@ EOF
|
|||
promptuser() {
|
||||
|
||||
# Extract package at the end of a build if autoextract is set to 1
|
||||
if [ "$autoextract" = "1" ] && [ -z "$autobuild" ] && [ -n "$packlocation" ] ; then
|
||||
if [[ $autoextract = 1 ]] && [[ -z $autobuild ]] && [[ -n $packlocation ]] ; then
|
||||
echo "[INFO] Extracting package installer inside $srcdir/test..."
|
||||
mkdir -p "$srcdir/test"
|
||||
tar xvf "$packlocation" -C "$srcdir/test"
|
||||
|
@ -1336,7 +1333,7 @@ promptuser() {
|
|||
# Prompt the user at the end of a build whether to extract contents of a newly-built installer into a subdirectory
|
||||
# called "test" inside the package source directory the build was manually initiated from. Has no effect on
|
||||
# autobuilds since they are simply installed right away.
|
||||
if [ "$extractprompt" = "1" ] && [ -z "$autobuild" ] && [ -n "$packlocation" ] ; then
|
||||
if [[ $extractprompt = 1 ]] && [[ -z $autobuild ]] && [[ -n $packlocation ]] ; then
|
||||
while true ; do
|
||||
echo
|
||||
echo "[NOTIFY] '"$app"' has been built and extractprompt is enabled in"
|
||||
|
@ -1361,7 +1358,7 @@ promptuser() {
|
|||
|
||||
# Prompt the user at the end of a successful build whether to install the newly created package. Has no effect on
|
||||
# autobuilds because packages there are installed automatically.
|
||||
if [ "$installprompt" = "1" ] && [ -z "$autobuild" ] && [ -n "$packlocation" ] ; then
|
||||
if [[ $installprompt = 1 ]] && [[ -z $autobuild ]] && [[ -n $packlocation ]] ; then
|
||||
while true ; do
|
||||
echo
|
||||
echo "[NOTIFY] '"$app"' successfully built and installprompt is enabled in the bldpkg.conf file."
|
||||
|
@ -1376,7 +1373,7 @@ promptuser() {
|
|||
done
|
||||
fi
|
||||
|
||||
if [ "$pkgstatus" = "0" ]; then
|
||||
if [[ $pkgstatus = 0 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue