Replace CocoASAIS with calsais

This commit is contained in:
Santiago Lo Coco 2022-01-17 17:48:44 -03:00
parent 310a651bbc
commit 5d6b3a7580
1 changed files with 22 additions and 22 deletions

View File

@ -24,7 +24,7 @@ updateSystemClock() {
} }
printAndExit() { printAndExit() {
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 calsais"
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 '{
@ -200,9 +200,9 @@ debug() {
if [ "$debugFlagToStdout" = true ]; then if [ "$debugFlagToStdout" = true ]; then
tee tee
elif [ "$debugFlagToFile" = true ]; then elif [ "$debugFlagToFile" = true ]; then
tee -a CocoASAIS.log > /dev/null tee -a calsais.log > /dev/null
elif [ "$debugFlag" = true ]; then elif [ "$debugFlag" = true ]; then
tee -a CocoASAIS.log tee -a calsais.log
else else
tee > /dev/null tee > /dev/null
fi fi
@ -271,7 +271,7 @@ getThePackages() {
set -o pipefail set -o pipefail
if [ ! -f "packages.csv" ]; then if [ ! -f "packages.csv" ]; then
printWaitBox printWaitBox
curl -LO "https://raw.githubusercontent.com/santilococo/CocoASAIS/master/packages.csv" 2>&1 | debug curl -LO "https://raw.githubusercontent.com/santilococo/calsais/master/packages.csv" 2>&1 | debug
fi fi
local IFS=, local IFS=,
while read -r NAME IMPORTANT INSTALLER; do while read -r NAME IMPORTANT INSTALLER; do
@ -405,16 +405,16 @@ grubSetUp() {
} }
saveVar() { saveVar() {
[ ! -f "CocoASAIS.vars" ] && touch CocoASAIS.vars [ ! -f "calsais.vars" ] && touch calsais.vars
if [ -z "$(grep "$1" CocoASAIS.vars)" ]; then if [ -z "$(grep "$1" calsais.vars)" ]; then
echo "$1=$2" >> CocoASAIS.vars echo "$1=$2" >> calsais.vars
else else
sed -i "s|$1=.*|$1=$2|" CocoASAIS.vars sed -i "s|$1=.*|$1=$2|" calsais.vars
fi fi
} }
loadVar() { loadVar() {
var=$(grep "$1=" CocoASAIS.vars | cut -d= -f2) var=$(grep "$1=" calsais.vars | cut -d= -f2)
export "$1"="$var" export "$1"="$var"
} }
@ -422,7 +422,7 @@ tryLoadVar() {
loadVar "$1" loadVar "$1"
if [ -z "${!1}" ]; then if [ -z "${!1}" ]; then
calcWidthAndRun "whiptail --msgbox \"Couldn't load '$1'. Try to run the script again.\" 7 WIDTH" calcWidthAndRun "whiptail --msgbox \"Couldn't load '$1'. Try to run the script again.\" 7 WIDTH"
rm -f CocoASAIS.vars rm -f calsais.vars
exit 1 exit 1
fi fi
} }
@ -467,8 +467,8 @@ installOtherPackages() {
} }
finishInstallation() { finishInstallation() {
cp CocoASAIS /mnt/usr/bin/CocoASAIS cp calsais /mnt/usr/bin/calsais
echo "sh /usr/bin/CocoASAIS && logout" >> /mnt/home/slococo/.bashrc echo "sh /usr/bin/calsais && logout" >> /mnt/home/slococo/.bashrc
rm -f /mnt/cocoScript rm -f /mnt/cocoScript
umount -R /mnt umount -R /mnt
whiptail --yesno "Finally, the PC needs to restart, would you like to restart now?" 0 0 whiptail --yesno "Finally, the PC needs to restart, would you like to restart now?" 0 0
@ -488,7 +488,7 @@ getDotfiles() {
sh scripts/bootstrap.sh -w sh scripts/bootstrap.sh -w
cd "$lastFolder" || printAndExit "Couldn't cd into $lastFolder" cd "$lastFolder" || printAndExit "Couldn't cd into $lastFolder"
sudo rm -f ~/.bashrc /usr/bin/CocoASAIS sudo rm -f ~/.bashrc /usr/bin/calsais
mkdir -p "$HOME/.cache/zsh" mkdir -p "$HOME/.cache/zsh"
touch "$HOME/.cache/zsh/.histfile" touch "$HOME/.cache/zsh/.histfile"
chsh -s "$(which zsh)" chsh -s "$(which zsh)"
@ -521,9 +521,9 @@ checkForSystemdUnit() {
printStepIfDebug() { printStepIfDebug() {
if [ "$debugFlagToFile" = true ] || [ "$debugFlag" = true ]; then if [ "$debugFlagToFile" = true ] || [ "$debugFlag" = true ]; then
printf '\n%s' "============================================================" >> CocoASAIS.log printf '\n%s' "============================================================" >> calsais.log
printf '\n%s\n' "$step" >> CocoASAIS.log printf '\n%s\n' "$step" >> calsais.log
printf '%s\n' "============================================================" >> CocoASAIS.log printf '%s\n' "============================================================" >> calsais.log
fi fi
} }
@ -548,7 +548,7 @@ runScript() {
debugFlag=false; debugFlagToFile=false; debugFlagToStdout=false debugFlag=false; debugFlagToFile=false; debugFlagToStdout=false
while getopts ':hdfs' 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-s\tDebug to stdout and to CocoASAIS.log file.\n\t-f\tDebug to CocoASAIS.log file.\t-s\tDebug to stdout.\n\n' "${0##*/}" && exit 0 ;; h) printf 'usage: %s [command]\n\t-h\tPrint this help message.\n\t-s\tDebug to stdout and to calsais.log file.\n\t-f\tDebug to calsais.log file.\t-s\tDebug to stdout.\n\n' "${0##*/}" && exit 0 ;;
d) debugFlag=true ;; d) debugFlag=true ;;
f) debugFlagToFile=true ;; f) debugFlagToFile=true ;;
s) debugFlagToStdout=true ;; s) debugFlagToStdout=true ;;
@ -558,9 +558,9 @@ runScript() {
clear clear
if [ -d "$HOME/Documents" ]; then if [ -d "$HOME/Documents" ]; then
whiptail --title "CocoASAIS" --msgbox "Now, we will finish the installation. Press OK and wait." 7 60 whiptail --title "calsais" --msgbox "Now, we will finish the installation. Press OK and wait." 7 60
getDotfiles getDotfiles
whiptail --title "CocoASAIS" --msgbox "All done!" 0 0 whiptail --title "calsais" --msgbox "All done!" 0 0
exit 0 exit 0
fi fi
@ -580,15 +580,15 @@ runScript() {
fi fi
if [ $i -gt 0 ]; then if [ $i -gt 0 ]; then
welcomeMsg="Welcome back to CocoASAIS!" welcomeMsg="Welcome back to calsais!"
else else
systemctl stop reflector.service systemctl stop reflector.service
checkForSystemdUnit "systemd units" "graphical.target" checkForSystemdUnit "systemd units" "graphical.target"
systemctl --no-block start reflector.service systemctl --no-block start reflector.service
welcomeMsg="Welcome to CocoASAIS!" welcomeMsg="Welcome to calsais!"
fi fi
whiptail --title "CocoASAIS" --msgbox "${welcomeMsg}" 0 0 whiptail --title "calsais" --msgbox "${welcomeMsg}" 0 0
while [ $i -lt "${#steps[@]}" ]; do while [ $i -lt "${#steps[@]}" ]; do
step=${steps[$i]} step=${steps[$i]}