Update height calculation and refactor
This commit is contained in:
parent
b5309ec759
commit
0e96306209
35
install.sh
35
install.sh
|
@ -31,13 +31,13 @@ updateSystemClock() {
|
||||||
exitIfCancel() {
|
exitIfCancel() {
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
str="${1} Therefore, the installation process will stop, but you can continue where you left off by running:\n\nsh CocoASAIS"
|
str="${1} Therefore, the installation process will stop, but you can continue where you left off by running:\n\nsh CocoASAIS"
|
||||||
newlines=$(printf $str | grep -c $'\n')
|
newlines=$(printf "$str" | grep -c $'\n')
|
||||||
chars=$(echo $str | wc -c)
|
chars=$(echo "$str" | wc -c)
|
||||||
height=$(echo "$chars" "$newlines" | awk '{
|
height=$(echo "$chars" "$newlines" | awk '{
|
||||||
x = (($1 - $2 + ($2 * 60)) / 60)
|
x = (($1 - $2 + ($2 * 60)) / 60)
|
||||||
printf "%d", (x == int(x)) ? x : int(x) + 1
|
printf "%d", (x == int(x)) ? x : int(x) + 1
|
||||||
}')
|
}')
|
||||||
whiptail --msgbox "$str" $height 60
|
whiptail --msgbox "$str" $((5+$height)) 60
|
||||||
echo "${2}" > CocoASAIS.log
|
echo "${2}" > CocoASAIS.log
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -311,28 +311,23 @@ steps=(
|
||||||
|
|
||||||
runScript() {
|
runScript() {
|
||||||
clear
|
clear
|
||||||
|
|
||||||
|
while getopts ':hd' flag; do
|
||||||
|
case $flag in
|
||||||
|
h) printf "usage: ${0##*/} [command]\n\t-h\t\t\tPrint this help message.\n\t-d\t\t\tDebug."
|
||||||
|
exit 0 ;;
|
||||||
|
d) debugFlag=true ;;
|
||||||
|
?) printf '%s: invalid option -''%s'\\n "${0##*/}" "$OPTARG"
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
if [ -d "$HOME/Documents" ]; then
|
if [ -d "$HOME/Documents" ]; then
|
||||||
getDotfiles
|
getDotfiles
|
||||||
whiptail --title "CocoASAIS" --msgbox "All done!" 0 0
|
whiptail --title "CocoASAIS" --msgbox "All done!" 0 0
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts ':hd' flag; do
|
|
||||||
case $flag in
|
|
||||||
h)
|
|
||||||
printf "usage: ${0##*/} [command]\n\t-h\t\t\tPrint this help message.\n\t-d\t\t\tDebug."
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
d)
|
|
||||||
debugFlag=true
|
|
||||||
;;
|
|
||||||
?)
|
|
||||||
printf '%s: invalid option -''%s'\\n "${0##*/}" "$OPTARG"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
i=0; found=false
|
i=0; found=false
|
||||||
if [ -f "CocoASAIS.log" ]; then
|
if [ -f "CocoASAIS.log" ]; then
|
||||||
lastStep=$(cat CocoASAIS.log)
|
lastStep=$(cat CocoASAIS.log)
|
||||||
|
@ -356,4 +351,4 @@ runScript() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
runScript
|
runScript $@
|
||||||
|
|
Loading…
Reference in New Issue