feat: improve handler detection and suffixes
This commit is contained in:
parent
ee98590ea5
commit
c5b53cfd7c
10 changed files with 41 additions and 10 deletions
4
handlers.available.ubuntu
Normal file
4
handlers.available.ubuntu
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
ubuntu
|
||||||
|
apt
|
||||||
|
binary
|
||||||
|
linux
|
7
handlers/apt/source
Executable file
7
handlers/apt/source
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
sudo apt-get install -y debian-keyring debian-archive-keyring apt-transport-https
|
||||||
|
curl="curl --tlsv1.2 -fsSL $1"
|
||||||
|
case $1 in
|
||||||
|
(*.gpg) sudo $curl -o "$2";;
|
||||||
|
(*.key) $curl | sudo gpg --dearmor --yes -o "$2";;
|
||||||
|
(*) echo 'Unknown key type' >&2; false;;
|
2
handlers/ubuntu/install
Executable file
2
handlers/ubuntu/install
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
sudo apt-get install -y "$@"
|
22
instalee
22
instalee
|
@ -16,8 +16,8 @@ export dir_home="$(dirname $(find "$INSTALEE_HOME" \
|
||||||
handlersfile="$dir_home/handlers.available"
|
handlersfile="$dir_home/handlers.available"
|
||||||
dir_packages="$dir_home/packages"
|
dir_packages="$dir_home/packages"
|
||||||
|
|
||||||
highlight() { echo "[4m[1m$1[0m" >&2; }
|
highlight() { echo $2 "[4m[1m$1[0m" >&2; }
|
||||||
destress() { echo "[2m$1[0m" >&2; }
|
destress() { echo $2 "[2m$1[0m" >&2; }
|
||||||
|
|
||||||
# Get the content of a file or the output of its execution
|
# Get the content of a file or the output of its execution
|
||||||
getcontent() {
|
getcontent() {
|
||||||
|
@ -77,12 +77,16 @@ installpkg() {
|
||||||
local install
|
local install
|
||||||
args="$(getcontent "$pkg_entry")"
|
args="$(getcontent "$pkg_entry")"
|
||||||
args="${args:-$1}"
|
args="${args:-$1}"
|
||||||
install="$(find "$handler" -name "install$ext" | head -1)"
|
installhandler="$(find "$handler" -name "install$ext")"
|
||||||
destress " $install $args"
|
if test -n "$installhandler"
|
||||||
pkg_entry="$install $args"
|
then pkg_entry="$installhandler $args"
|
||||||
|
else $(find "$handler" -name "${ext#_}") $args
|
||||||
|
pkg_entry="$(find "$handler" -name "install") $1"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
destress " running unhandled $pkg_entry"
|
destress " running unhandled" -n
|
||||||
fi
|
fi
|
||||||
|
destress " $pkg_entry"
|
||||||
$pkg_entry
|
$pkg_entry
|
||||||
)
|
)
|
||||||
set +e
|
set +e
|
||||||
|
@ -135,7 +139,8 @@ case "$1" in
|
||||||
while printf "Handler? (Ctrl-C or Ctrl-D to exit, / to list all) " && read handler
|
while printf "Handler? (Ctrl-C or Ctrl-D to exit, / to list all) " && read handler
|
||||||
do
|
do
|
||||||
case "$handler" in
|
case "$handler" in
|
||||||
(/*) find "$dir_packages" "$dir_home/handlers" -type f -not -name "depends*" -printf "%f\n" | sort | uniq | paste -s -d ' ';;
|
(/*) find "$dir_packages" "$dir_home/handlers" -type f -not -name "depends*" -printf "%f\n" |
|
||||||
|
sort | uniq | paste -s -d ' ';;
|
||||||
(*) ${EDITOR:-vi} "$dir/$handler";;
|
(*) ${EDITOR:-vi} "$dir/$handler";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -163,9 +168,8 @@ runinstalee() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO Manjaro
|
|
||||||
if ! test -f "$handlersfile"
|
if ! test -f "$handlersfile"
|
||||||
then copy="$(find "$dir_home" -name "handlers.available.*" -exec sh -c "echo {} | rev | cut -d'.' -f1 | rev | xargs -i% expr $(cat /etc/os-release | grep '^ID=' | cut -d= -f2 | grep . || lsb_release -s -i | tr 'A-Z' 'a-z') : % >/dev/null" \; -a -print)" &&
|
then copy=$(ls $({ cat /etc/os-release | grep -E '^ID(_LIKE)?=' | cut -d= -f2 | grep . || lsb_release -s -i | tr 'A-Z' 'a-z'; } | sed 's/^/handlers.available./' | paste -d' ' -s) 2>/dev/null | head -1) &&
|
||||||
test -n "$copy" &&
|
test -n "$copy" &&
|
||||||
echo "Bootstrapping available handlers from $copy" &&
|
echo "Bootstrapping available handlers from $copy" &&
|
||||||
cp "$copy" "$handlersfile" || {
|
cp "$copy" "$handlersfile" || {
|
||||||
|
|
1
packages/caddy/apt
Normal file
1
packages/caddy/apt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
5
packages/kubectl/apt
Normal file → Executable file
5
packages/kubectl/apt
Normal file → Executable file
|
@ -1,4 +1,7 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
|
{
|
||||||
|
sudo curl --tlsv1.2 -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
|
||||||
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
||||||
|
sudo apt-get update
|
||||||
|
} >&2
|
||||||
echo kubectl
|
echo kubectl
|
||||||
|
|
10
packages/xcaddy/apt
Executable file
10
packages/xcaddy/apt
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
{
|
||||||
|
sudo apt-get install -y debian-keyring debian-archive-keyring apt-transport-https
|
||||||
|
curl --tlsv1.2 -sSLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/gpg.key' |
|
||||||
|
sudo gpg --dearmor --yes -o /usr/share/keyrings/caddy-xcaddy-archive-keyring.gpg
|
||||||
|
curl --tlsv1.2 -sSLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/debian.deb.txt' |
|
||||||
|
sudo tee /etc/apt/sources.list.d/caddy-xcaddy.list
|
||||||
|
sudo apt-get update
|
||||||
|
} >&2
|
||||||
|
echo xcaddy
|
Loading…
Add table
Reference in a new issue