Set pipefail (to get the exit code of the last program that returned nonzero (in a pipe))
This commit is contained in:
parent
9faa2908e8
commit
ac6d07679a
21
install.sh
21
install.sh
|
@ -105,17 +105,17 @@ mountPart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
debug() {
|
debug() {
|
||||||
if [ $debugFlag = true ]; then
|
while read input; do
|
||||||
while read input; do
|
if [ $debugFlag = true ]; then
|
||||||
echo $input
|
echo $input
|
||||||
done
|
else
|
||||||
else
|
echo $input > /dev/null 2>&1
|
||||||
return
|
fi
|
||||||
fi
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
installPackage() {
|
installPackage() {
|
||||||
calcWidthAndRun "whiptail --infobox "Installing '$1'." 7 WIDTH"
|
calcWidthAndRun "whiptail --infobox \"Installing '$1'.\" 7 WIDTH"
|
||||||
case ${2} in
|
case ${2} in
|
||||||
Y)
|
Y)
|
||||||
if [ -z $username ]; then
|
if [ -z $username ]; then
|
||||||
|
@ -147,6 +147,7 @@ checkForParu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
getThePackages() {
|
getThePackages() {
|
||||||
|
set -o pipefail
|
||||||
if [ ! -f "packages.csv" ]; then
|
if [ ! -f "packages.csv" ]; then
|
||||||
curl -LO "https://raw.githubusercontent.com/santilococo/CocoASAIS/master/packages.csv" > /dev/null 2>&1
|
curl -LO "https://raw.githubusercontent.com/santilococo/CocoASAIS/master/packages.csv" > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
@ -155,7 +156,8 @@ getThePackages() {
|
||||||
if [ "$IMPORTANT" = "${1}" ]; then
|
if [ "$IMPORTANT" = "${1}" ]; then
|
||||||
installPackage "$NAME" "$AUR" "${2}"
|
installPackage "$NAME" "$AUR" "${2}"
|
||||||
fi
|
fi
|
||||||
done < packages.csv
|
done < packages.csv
|
||||||
|
set +o pipefail
|
||||||
}
|
}
|
||||||
|
|
||||||
installImportantPackages() {
|
installImportantPackages() {
|
||||||
|
@ -310,9 +312,10 @@ steps=(
|
||||||
)
|
)
|
||||||
|
|
||||||
runScript() {
|
runScript() {
|
||||||
|
debugFlag=false
|
||||||
while getopts ':hd' flag; do
|
while getopts ':hd' flag; do
|
||||||
case $flag in
|
case $flag in
|
||||||
h) printf "usage: ${0##*/} [command]\n\t-h\t\t\tPrint this help message.\n\t-d\t\t\tDebug."
|
h) printf "usage: ${0##*/} [command]\n\t-h\tPrint this help message.\n\t-d\tDebug.\n"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
d) debugFlag=true ;;
|
d) debugFlag=true ;;
|
||||||
?) printf '%s: invalid option -''%s'\\n "${0##*/}" "$OPTARG"
|
?) printf '%s: invalid option -''%s'\\n "${0##*/}" "$OPTARG"
|
||||||
|
|
Loading…
Reference in New Issue