testing
This commit is contained in:
parent
f4af62f822
commit
963151c7ee
1 changed files with 28 additions and 45 deletions
73
test.sh
73
test.sh
|
@ -5,7 +5,7 @@ command_exists() {
|
||||||
command -v "$@" >/dev/null 2>&1
|
command -v "$@" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
getImports() {
|
source-script() {
|
||||||
local url="https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh"
|
local url="https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh"
|
||||||
local import="$(mktemp)"
|
local import="$(mktemp)"
|
||||||
if command_exists curl; then
|
if command_exists curl; then
|
||||||
|
@ -22,8 +22,8 @@ getImports() {
|
||||||
rm -f "$import"
|
rm -f "$import"
|
||||||
}
|
}
|
||||||
|
|
||||||
getDependencies() {
|
spin-get-dependencies() {
|
||||||
echo_info "Checking build dependencies.."
|
spin grey "Getting dependencies.."
|
||||||
|
|
||||||
# INFO:
|
# INFO:
|
||||||
# ╭─────────────────────────────────────────────────────────────────────────╮
|
# ╭─────────────────────────────────────────────────────────────────────────╮
|
||||||
|
@ -36,6 +36,9 @@ getDependencies() {
|
||||||
depsArch=()
|
depsArch=()
|
||||||
depsAlpine=()
|
depsAlpine=()
|
||||||
|
|
||||||
|
declare -A deplist
|
||||||
|
local deplist=()
|
||||||
|
|
||||||
declare -A deps=(
|
declare -A deps=(
|
||||||
[debian]="depsDebian"
|
[debian]="depsDebian"
|
||||||
[ubuntu]="depsUbuntu"
|
[ubuntu]="depsUbuntu"
|
||||||
|
@ -53,7 +56,13 @@ getDependencies() {
|
||||||
|
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
debian | ubuntu | arch | fedora | alpine | opensuse)
|
debian | ubuntu | arch | fedora | alpine | opensuse)
|
||||||
checkAndInstall "${pkgArray[@]}"
|
for pkg in "${pkgArray[@]}"; do
|
||||||
|
if ! command_exists $pkg; then
|
||||||
|
deplist+=$pkg
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
pkglist="${deplist[@]}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo_error "There are no dependencies to install for $distro"
|
echo_error "There are no dependencies to install for $distro"
|
||||||
|
@ -65,50 +74,22 @@ getDependencies() {
|
||||||
# echo default
|
# echo default
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if $silent; then
|
local err
|
||||||
pen bold red "Executing script silently!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Kindly ask for input (empty answer is accepted)
|
if ! spin-get-dependencies; then
|
||||||
seek name "What's your name?"
|
throw "Dependencies could not get generated!"
|
||||||
pen "Hello, $name!"
|
|
||||||
|
|
||||||
# Firmly ask for input (empty answer NOT accepted)
|
|
||||||
# request name "No really, what's your name?"
|
|
||||||
# pen "There you go, $name!"
|
|
||||||
|
|
||||||
# Yes/no confirmation (defaults to "yes")
|
|
||||||
if confirm "Continue?"; then
|
|
||||||
spin "Working on it.."
|
|
||||||
sleep 2
|
|
||||||
check "Done!"
|
|
||||||
pen green "Continuing..."
|
|
||||||
else
|
else
|
||||||
spin "Working on it.."
|
check "Dependency list generated!"
|
||||||
sleep 2
|
|
||||||
check "Done!"
|
spin bold yellow "Installing packagelist.. ${pkglist[@]}"
|
||||||
pen red "waiting.."
|
if run --err err pkg-install "${pkglist[*]}"; then
|
||||||
sleep 2
|
check "Installed packages!"
|
||||||
repen spin "Almost done.."
|
else
|
||||||
sleep 2
|
throw "$(pen bold blue ${pkglist[*]}) could not get installed!"
|
||||||
repen spin "Waiting some more.."
|
echo_error "${err:-}"
|
||||||
sleep 2
|
fi
|
||||||
check "Task completed!"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Defaulting to "no"
|
|
||||||
if confirm --default-no "Are you sure?"; then
|
|
||||||
pen green "Proceeding..."
|
|
||||||
else
|
|
||||||
pen red "Cancelled."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Menu selection
|
|
||||||
choose color "Select a color:" "Red" "Green" "Blue"
|
|
||||||
pen "You selected: $color"
|
|
||||||
|
|
||||||
# source_script "https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh"
|
|
||||||
|
|
||||||
# case "$distro" in
|
# case "$distro" in
|
||||||
# arch)
|
# arch)
|
||||||
# pen bold blue "This is Arch!"
|
# pen bold blue "This is Arch!"
|
||||||
|
@ -133,9 +114,11 @@ main() {
|
||||||
# exit 1
|
# exit 1
|
||||||
# ;;
|
# ;;
|
||||||
# esac
|
# esac
|
||||||
|
# source_script "https://git.k4li.de/scripts/beddu/raw/branch/main/dist/beddu.sh"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if getImports; then
|
if source-script; then
|
||||||
# ─< package variable >───────────────────────────────────────────────────────────────────
|
# ─< package variable >───────────────────────────────────────────────────────────────────
|
||||||
unset PACKAGE
|
unset PACKAGE
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue