fixed pkgui
This commit is contained in:
parent
b1012d36a5
commit
53761dca87
1 changed files with 39 additions and 18 deletions
57
pkgui.sh
57
pkgui.sh
|
@ -9,7 +9,7 @@
|
||||||
# WHY:
|
# WHY:
|
||||||
# This import will give you the following variables:
|
# This import will give you the following variables:
|
||||||
# _sudo="sudo -E" <- only if non root user
|
# _sudo="sudo -E" <- only if non root user
|
||||||
# distro = <distro name, like 'arch', 'debian', 'ubuntu', 'fedora', 'opensuse' or 'alpine'>
|
# distro = <distro name, like 'arch', 'debian', 'fedora'..>
|
||||||
# arch = bool
|
# arch = bool
|
||||||
# fedora = bool
|
# fedora = bool
|
||||||
# opensuse = bool....
|
# opensuse = bool....
|
||||||
|
@ -18,14 +18,24 @@
|
||||||
# CAUTION:
|
# CAUTION:
|
||||||
# This only wokrs for generic package names, like neovim, or vim, or tmux etc..
|
# 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..
|
# not every package packagemanager has the same packagenames for their packages..
|
||||||
if command_exists curl; then
|
getImports() {
|
||||||
eval "$(curl -fsSL https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh)"
|
i="https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh"
|
||||||
else
|
import="$(mktemp)"
|
||||||
echo "curl is required, but missing.."
|
if command_exists curl; then
|
||||||
exit 1
|
curl -fsSL $i -o $import
|
||||||
fi
|
else
|
||||||
|
echo "curl is required, but missing.."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$import"
|
||||||
|
sleep 0.3
|
||||||
|
rm "$import"
|
||||||
|
echo_warning "cleaned $import"
|
||||||
|
}
|
||||||
|
|
||||||
checkDeps() {
|
checkDeps() {
|
||||||
|
echo_info "Checking dependencies.."
|
||||||
if ! command_exists pkgui; then
|
if ! command_exists pkgui; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
@ -56,12 +66,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
instDeps() {
|
instDeps() {
|
||||||
|
echo_info "Installing missing dependencies.."
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
arch | opensuse | fedora)
|
arch | opensuse | fedora)
|
||||||
_install go
|
run _install go
|
||||||
;;
|
;;
|
||||||
debian | ubuntu)
|
debian | ubuntu)
|
||||||
_install golang
|
run _install golang
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo_error "$distro is not supported by this script"
|
echo_error "$distro is not supported by this script"
|
||||||
|
@ -72,6 +83,7 @@
|
||||||
getPkgUI() {
|
getPkgUI() {
|
||||||
local tempDir="$(mktemp -d)"
|
local tempDir="$(mktemp -d)"
|
||||||
local url="https://git.k4li.de/scripts/installs/raw/branch/main/.src/pkgui"
|
local url="https://git.k4li.de/scripts/installs/raw/branch/main/.src/pkgui"
|
||||||
|
echo_info "Getting the pkgui binary from $url"
|
||||||
cd $tempDir || mkdir $tempDir && cd $tempDir
|
cd $tempDir || mkdir $tempDir && cd $tempDir
|
||||||
|
|
||||||
echo_info "Curling the binary directly via $url.."
|
echo_info "Curling the binary directly via $url.."
|
||||||
|
@ -84,23 +96,32 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
instPkgUI() {
|
instPkgUI() {
|
||||||
|
echo_info "Installing the binary"
|
||||||
if [ -d "$HOME/.local/bin" ]; then
|
if [ -d "$HOME/.local/bin" ]; then
|
||||||
ln -srf ./pkgui "$HOME/.local/bin/pkgui" && echo_note "Linked to $HOME/.local/bin/pkgui"
|
run ln -srf ./pkgui "$HOME/.local/bin/pkgui" && echo_note "Linked to $HOME/.local/bin/pkgui"
|
||||||
else
|
else
|
||||||
echo_note "Couldn't find $HOME/.local/bin directory, linking systemwide.."
|
echo_note "Couldn't find $HOME/.local/bin directory, linking systemwide.."
|
||||||
$_sudo ln -sfr ./pkgui /bin/pkgui && echo_note "Linked to /bin/pkgui"
|
run $_sudo ln -sfr ./pkgui /bin/pkgui && echo_note "Linked to /bin/pkgui"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if checkDeps; then
|
checkDeps
|
||||||
if instDeps; then
|
instDeps
|
||||||
if getPkgUI; then
|
getPkgUI
|
||||||
instPkgUI
|
instPkgUI
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if getImports; then
|
||||||
|
case "$1" in
|
||||||
|
--silent | -s)
|
||||||
|
silent=true
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
silent=false
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
main
|
main
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue