Use tee in debug() and add flag '-s'
This commit is contained in:
parent
bcbbc25636
commit
e3f21ae705
|
@ -21,7 +21,7 @@ and then
|
||||||
sh CocoASAIS
|
sh CocoASAIS
|
||||||
```
|
```
|
||||||
|
|
||||||
You can use `-d` or `-f` to debug.
|
You can use `-d`, `-f` or `-s` to debug.
|
||||||
|
|
||||||
The script only supports UEFI boot mode.
|
The script only supports UEFI boot mode.
|
||||||
|
|
||||||
|
|
35
install.sh
35
install.sh
|
@ -146,15 +146,15 @@ mountPart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
debug() {
|
debug() {
|
||||||
while read -r input; do
|
if [ $debugFlagToStdout = true ]; then
|
||||||
if [ $debugFlag = true ]; then
|
tee
|
||||||
tee
|
elif [ $debugFlagToFile = true ]; then
|
||||||
elif [ $debugFlagToFile = true ]; then
|
tee -a CocoASAIS.debug > /dev/null
|
||||||
echo "$input" >> CocoASAIS.debug
|
elif [ $debugFlag = true ]; then
|
||||||
else
|
tee -a CocoASAIS.debug
|
||||||
echo "$input" > /dev/null 2>&1
|
else
|
||||||
fi
|
tee > /dev/null
|
||||||
done
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
installPackage() {
|
installPackage() {
|
||||||
|
@ -166,12 +166,20 @@ installPackage() {
|
||||||
B)
|
B)
|
||||||
runInChroot "pacman -Q ${1}" 2>&1 | debug
|
runInChroot "pacman -Q ${1}" 2>&1 | debug
|
||||||
[ $? -eq 0 ] && return
|
[ $? -eq 0 ] && return
|
||||||
runInChroot "script -qec \"pacman -S --needed --noconfirm ${1}\" /dev/null" 2>&1 | debug
|
if [ $debugFlagToStdout = true ] || [ $debugFlag = true ]; then
|
||||||
|
runInChroot "script -qec \"pacman -S --needed --noconfirm ${1}\" /dev/null" 2>&1 | debug
|
||||||
|
else
|
||||||
|
runInChroot "pacman -S --needed --noconfirm ${1}" 2>&1 | debug
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
C)
|
C)
|
||||||
runInChroot "sudo -u $username paru -Q ${1}" 2>&1 | debug
|
runInChroot "sudo -u $username paru -Q ${1}" 2>&1 | debug
|
||||||
[ $? -eq 0 ] && return
|
[ $? -eq 0 ] && return
|
||||||
runInChroot "script -qec \"sudo -u $username paru -S --needed --noconfirm --skipreview ${1}\" /dev/null" 2>&1 | debug
|
if [ $debugFlagToStdout = true ] || [ $debugFlag = true ]; then
|
||||||
|
runInChroot "script -qec \"sudo -u $username paru -S --needed --noconfirm --skipreview ${1}\" /dev/null" 2>&1 | debug
|
||||||
|
else
|
||||||
|
runInChroot "sudo -u $username paru -S --needed --noconfirm --skipreview ${1}" 2>&1 | debug
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
?)
|
?)
|
||||||
logAndExit "INSTALL must be A, B or C in packages.csv file." "${3}"
|
logAndExit "INSTALL must be A, B or C in packages.csv file." "${3}"
|
||||||
|
@ -407,12 +415,13 @@ steps=(
|
||||||
)
|
)
|
||||||
|
|
||||||
runScript() {
|
runScript() {
|
||||||
debugFlag=false; debugFlagToFile=false
|
debugFlag=false; debugFlagToFile=false; debugFlagToStdout=false
|
||||||
while getopts ':hdf' flag; do
|
while getopts ':hdfs' flag; do
|
||||||
case $flag in
|
case $flag in
|
||||||
h) printf 'usage: %s [command]\n\t-h\tPrint this help message.\n\t-d\tDebug to stdout.\n\t-d\tDebug to CocoASAIS.debug file.\n' "${0##*/}" && exit 0 ;;
|
h) printf 'usage: %s [command]\n\t-h\tPrint this help message.\n\t-d\tDebug to stdout.\n\t-d\tDebug to CocoASAIS.debug file.\n' "${0##*/}" && exit 0 ;;
|
||||||
d) debugFlag=true ;;
|
d) debugFlag=true ;;
|
||||||
f) debugFlagToFile=true ;;
|
f) debugFlagToFile=true ;;
|
||||||
|
s) debugFlagToStdout=true ;;
|
||||||
?) printf '%s: invalid option -''%s'\\n "${0##*/}" "$OPTARG" && exit 1 ;;
|
?) printf '%s: invalid option -''%s'\\n "${0##*/}" "$OPTARG" && exit 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue