This commit is contained in:
pika 2025-05-23 21:24:36 +02:00
parent 85be06d7a3
commit 259b2cd66a

111
test.sh
View file

@ -6,16 +6,6 @@
command -v "$@" >/dev/null 2>&1
}
# run() {
# if $silent; then
# # silentexec "$@" &
# spin "Installing packages" &
# silentexec "$@"
# else
# "$@"
# fi
# }
# WHY:
# This import will give you the following variables:
# _sudo="sudo -E" <- only if non root user
@ -50,95 +40,62 @@
choose multiplexer "Select a multiplexer" tmux zellij </dev/tty
choose menu "Select a menu package" rofi wofi tofi </dev/tty
choose shell "Select a shell" zsh bash fish nushell </dev/tty
stuff=(
$multiplexer
$menu
$shell
$package
)
}
install-stuff() {
ask-stuff
local err
arr=(
firefox-bin
blender-bin
$package
nautilus
firefox-esr
)
# case "$distro" in
# arch)
# $_sudo pacman -Syu
# ;;
# esac
check-and-install ${arr[@]} ${stuff[@]}
check-and-install ${arr[@]}
if confirm "Do you want to remove the previous installed packages?"; then
if confirm "Do you want to remove the previous installed (doesn't inclued the stuff you put in yourself) packages?"; then
line
pen grey bold "Packages to remove: $(pen bold red ${#arr[@]})"
for pkg in "${arr[@]}"; do
pkg-remove $pkg
spin "Removing $pkg"
if run --err err pkg-remove $pkg; then
upclear
check "Removed $pkg"
else
upclear
throw "Error removing $pkg"
echo-error "${err:-}"
fi
done
fi
}
func1() {
spin yellow "installing stuff"
# if run install-stuff; then
if run --err err --out out git clone --depth=1 https://github.com/neovim/neovim.git; then
check "Installation complete"
line
pen "${out:-}"
else
throw "Installation failed!"
pen "${err:-}"
fi
}
func2() {
# run --err install-stuff
if [ -d ./neovim ]; then
if confirm "$(pen bold blue 'Do you want to remove the cloned ./neovim directory?')" </dev/tty; then
rm -rf ./neovim/
else
pen red bold "Did not remove the neovim directory!"
fi
fi
}
func3() {
local err
arr=(
firefox-esr
)
if $arch; then
spin blue "Installing.."
if run --err err checkAndInstall "${arr[@]}"; then
check "Installed $(pen red ${arr[*]})"
else
throw "Something went wrong installing ${arr[*]}.."
throw "${err:-}"
fi
fi
}
main() {
# if $silent; then
# echo_warning "Executing script silently!"
# fi
# func1
# func2
# func3
# if ask-stuff; then
seek package "What packages should also get installed? space separated list.." </dev/tty
if confirm "Do you want to 'install-stuff'?" </dev/tty; then
line
install-stuff
fi
# fi
# while install-stuff && break; do
# spin "Installing packages.."
# for i in {3..6}; do
# spin grey "Testing $i seconds.."
# if sleep $i; then
# upclear
# check green bold "Successfully waited $i seconds!"
# # line
# fi
# done
}
dream="https://git.k4li.de/scripts/imports/raw/branch/main/dream.sh"
if getImports "$dream"; then
main
fi
# fi
}