feat: run all handlers in a tempdir

This commit is contained in:
xeruf 2022-09-10 00:05:02 +02:00
parent c605b6af8d
commit eada9a0b9c
8 changed files with 14 additions and 13 deletions

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
# Install a package from a local or downloaded .deb-file and remove it # Install a package from a local or downloaded .deb-file and remove it
loc="/tmp/install.deb" loc="$(basename "$arg")"
case "$1" in case "$1" in
(http*) sudo wget -O "$loc" "$arg";; (http*) wget -O "$loc" "$arg";;
(*) loc="$arg";; (*) loc="$arg";;
esac esac
sudo dpkg -i "$loc" sudo dpkg -i "$loc"
sudo apt -f install sudo apt -f install
sudo rm -f "$loc" sudo rm -v "$loc"

View File

@ -3,7 +3,6 @@ case "$1" in
(*://*) url=$1;; (*://*) url=$1;;
(*) url=https://aur.archlinux.org/$1.git;; (*) url=https://aur.archlinux.org/$1.git;;
esac esac
cd "$(mktemp -d)"
git clone "$url" git clone "$url"
cd $(basename "${1%.git}") cd $(basename "${1%.git}")
makepkg -si makepkg -si

View File

@ -1,7 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
case $1 in case $1 in
(*://*) cd "$(mktemp -d)" (*://*) git clone "$1"
git clone "$1"
cd "$(basename "${1%.git}")";; cd "$(basename "${1%.git}")";;
(*) cd "$1";; (*) cd "$1";;
esac esac

View File

@ -47,12 +47,14 @@ installpkg() {
set -e set -e
local name="$(basename $pkg)" local name="$(basename $pkg)"
local base="${name%_*}" local base="${name%_*}"
echo "Dependencies"
for dependency in $(cat "${pkgdir}depends" "${pkgdir}${base}_depends" 2>/dev/null) for dependency in $(cat "${pkgdir}depends" "${pkgdir}${base}_depends" 2>/dev/null)
do runinstalee $dependency do runinstalee $dependency | sed 's/^/ /'
done done
local ext="${name#$base}" local ext="${name#$base}"
local handler="$homedir/handlers/$base" local handler="$homedir/handlers/$base"
cd $(mktemp -d --tmpdir=$execdir $pkg.XXXX)
if test -d "$handler" if test -d "$handler"
then then
# This declaration needs to be ahead, otherwise it overrides failing exit codes # This declaration needs to be ahead, otherwise it overrides failing exit codes
@ -118,6 +120,9 @@ case "$1" in
;; ;;
esac esac
execdir=/tmp/instalee.%(date +%s)
mkdir -p $execdir
cd $execdir
runinstalee() { runinstalee() {
groupfile="$homedir/groups/$1" groupfile="$homedir/groups/$1"
if test -f "$groupfile" if test -f "$groupfile"

View File

@ -1,5 +1,4 @@
#!/bin/sh -ex #!/bin/sh -ex
cd "$(mktemp -d)"
OS="$(uname | tr '[:upper:]' '[:lower:]')" OS="$(uname | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')"
KREW="krew-${OS}_${ARCH}" KREW="krew-${OS}_${ARCH}"

View File

@ -1,5 +1,4 @@
#!/bin/sh -e #!/bin/sh -e
cd "$(mktemp -d)"
git clone https://github.com/grafana/loki.git git clone https://github.com/grafana/loki.git
cd loki cd loki
make logcli >&2 make logcli >&2

View File

@ -1,6 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
cd /opt cd /opt
git clone git://github.com/sickill/stderred.git git clone git://github.com/sickill/stderred.git
cd stderred cd stderred
make make
case "$LD_PRELOAD" in *libstderred.so*) ;; *) echo 'export LD_PRELOAD="/opt/stderred/build/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"'>>$HOME/.zprofile;; esac case "$LD_PRELOAD" in (*libstderred.so*) ;;
(*) echo 'export LD_PRELOAD="/opt/stderred/build/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"'>>$HOME/.zprofile;; esac

View File

@ -1,5 +1,4 @@
#!/usr/bin/env sh #!/bin/sh -e
cd "$(mktemp -d)"
git clone https://github.com/nonpop/xkblayout-state git clone https://github.com/nonpop/xkblayout-state
cd xkblayout-state cd xkblayout-state
make make