kiss-chbuild: Simplify script

This commit is contained in:
Dylan Araps 2020-04-18 12:20:13 +03:00
parent 6786d2ca0a
commit 23448e5079
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

View File

@ -5,19 +5,12 @@ log() {
printf '\033[31;1m->\033[m %s.\n' "$@" printf '\033[31;1m->\033[m %s.\n' "$@"
} }
clean() {
log "Destroying chroot"
su -c "rm -rf chroot-$pid" || clean
}
pid=$$
url=https://github.com/kisslinux/repo/releases/download/1.9.11/
cd "${cac_dir:=$KISS_ROOT${XDG_CACHE_HOME:-$HOME/.cache}/kiss}" cd "${cac_dir:=$KISS_ROOT${XDG_CACHE_HOME:-$HOME/.cache}/kiss}"
[ -f kiss-chroot.tar.xz ] || { [ -f kiss-chroot.tar.xz ] || {
log "Downloading chroot tarball" log "Downloading chroot tarball"
url=https://github.com/kisslinux/repo/releases/download/1.9.11/
wget "$url/kiss-chroot.tar.xz" wget "$url/kiss-chroot.tar.xz"
} }
@ -27,9 +20,7 @@ cd "${cac_dir:=$KISS_ROOT${XDG_CACHE_HOME:-$HOME/.cache}/kiss}"
} }
log "Creating temporary chroot" log "Creating temporary chroot"
cp -a kiss-chroot "chroot-$pid" cp -a kiss-chroot "chroot-$$"
trap clean EXIT INT
log "Entering chroot" log "Entering chroot"
su -c "kiss-chroot chroot-$pid" su -c "kiss-chroot chroot-$$; rm -rf chroot-$$"