wip
This commit is contained in:
parent
c583880054
commit
8e7640758b
1 changed files with 20 additions and 24 deletions
44
pkgui.sh
44
pkgui.sh
|
@ -14,12 +14,12 @@
|
|||
# fedora = bool
|
||||
# opensuse = bool....
|
||||
# You can then use it for, `if $arch; then`
|
||||
# Also this gives you the _install command, which installs a package pased on the packagemanager/distro used.
|
||||
# Also this gives you the pkg-install command, which installs a package pased on the packagemanager/distro used.
|
||||
# CAUTION:
|
||||
# This only wokrs for generic package names, like neovim, or vim, or tmux etc..
|
||||
# not every package packagemanager has the same packagenames for their packages..
|
||||
getImports() {
|
||||
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
|
||||
i="https://git.k4li.de/scripts/imports/raw/branch/main/dream.sh"
|
||||
import="$(mktemp)"
|
||||
if command_exists curl; then
|
||||
curl -fsSL $i -o $import
|
||||
|
@ -31,15 +31,15 @@
|
|||
source "$import"
|
||||
sleep 0.3
|
||||
rm "$import"
|
||||
echo_warning "cleaned $import"
|
||||
pen bold yellow "cleaned $import"
|
||||
}
|
||||
|
||||
checkDeps() {
|
||||
echo_info "Checking dependencies.."
|
||||
pen bold blue "Checking dependencies.."
|
||||
if ! command_exists pkgui; then
|
||||
return 0
|
||||
else
|
||||
echo_warning "pkgui is already installed.."
|
||||
pen bold yellow "pkgui is already installed.."
|
||||
return 69
|
||||
fi
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
|||
if command_exists $pkg; then
|
||||
return 0
|
||||
else
|
||||
echo_warning "$pkg is already installed.."
|
||||
pen bold yellow "$pkg is already installed.."
|
||||
return 69
|
||||
fi
|
||||
;;
|
||||
|
@ -57,7 +57,7 @@
|
|||
if command_exists $pkg; then
|
||||
return 0
|
||||
else
|
||||
echo_warning "$pkg is required, but missing.."
|
||||
pen bold yellow "$pkg is required, but missing.."
|
||||
return 69
|
||||
fi
|
||||
;;
|
||||
|
@ -66,16 +66,16 @@
|
|||
}
|
||||
|
||||
instDeps() {
|
||||
echo_info "Installing missing dependencies.."
|
||||
pen bold blue "Installing missing dependencies.."
|
||||
case "$distro" in
|
||||
arch | opensuse | fedora)
|
||||
run _install go
|
||||
pkg-install go
|
||||
;;
|
||||
debian | ubuntu)
|
||||
run _install golang
|
||||
pkg-install golang
|
||||
;;
|
||||
*)
|
||||
echo_error "$distro is not supported by this script"
|
||||
echo-error "$distro is not supported by this script"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -83,35 +83,31 @@
|
|||
getPkgUI() {
|
||||
local tempDir="$(mktemp -d)"
|
||||
local url="https://git.k4li.de/scripts/installs/raw/branch/main/.src/pkgui"
|
||||
echo_info "Getting the pkgui binary from $url"
|
||||
pen bold blue "Getting the pkgui binary from $url"
|
||||
cd $tempDir || mkdir $tempDir && cd $tempDir
|
||||
|
||||
echo_info "Curling the binary directly via $url.."
|
||||
# echo_warning "DEBUG:
|
||||
# $PWD
|
||||
# $(ls -la)
|
||||
# "
|
||||
curl -fsSL $url -o pkgui || echo_warning "Could not curl $url"
|
||||
pen bold blue "Curling the binary directly via $url.."
|
||||
curl -fsSL $url -o pkgui || pen bold yellow "Could not curl $url"
|
||||
chmod +x ./pkgui
|
||||
}
|
||||
|
||||
instPkgUI() {
|
||||
echo_info "Installing the binary"
|
||||
pen bold blue "Installing the binary"
|
||||
if [ -d "$HOME/.local/bin" ]; then
|
||||
run ln -srf ./pkgui "$HOME/.local/bin/pkgui" && echo_note "Linked to $HOME/.local/bin/pkgui"
|
||||
ln -srf ./pkgui "$HOME/.local/bin/pkgui" && pen bold blue "Linked to $HOME/.local/bin/pkgui"
|
||||
else
|
||||
echo_note "Couldn't find $HOME/.local/bin directory, linking systemwide.."
|
||||
run $_sudo ln -sfr ./pkgui /bin/pkgui && echo_note "Linked to /bin/pkgui"
|
||||
pen bold blue "Couldn't find $HOME/.local/bin directory, linking systemwide.."
|
||||
$_sudo ln -sfr ./pkgui /bin/pkgui && pen bold blue "Linked to /bin/pkgui"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
if $silent; then
|
||||
echo_warning "Executing script silently!"
|
||||
pen bold yellow "Executing script silently!"
|
||||
fi
|
||||
|
||||
if ! getDependencies; then
|
||||
echo_error "Error when installing dependencies.."
|
||||
echo-error "Error when installing dependencies.."
|
||||
fi
|
||||
checkDeps
|
||||
instDeps
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue