From 0d98778e7a41ad9079411d4267c20461b93ef974 Mon Sep 17 00:00:00 2001 From: Timo Reymann Date: Wed, 20 Jul 2022 10:20:40 +0200 Subject: [PATCH] feat: Make installer work with parallel installations --- installer | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/installer b/installer index 8cc0b15..0955693 100644 --- a/installer +++ b/installer @@ -19,6 +19,8 @@ _ok() { exit 1 fi + _pid="$$" + if [ "${UID:-$(id -u)}" -ne 0 ]; then echo -n "Installer is not running as root, trying to use sudo ..." SUDO="sudo" @@ -47,11 +49,11 @@ _ok() { _ok echo -n "Download binary for ${latest_version} ... " - curl -LsS https://github.com/timo-reymann/deterministic-zip/releases/download/${latest_version}/${artifact} -o /tmp/deterministic-zip + curl -LsS https://github.com/timo-reymann/deterministic-zip/releases/download/${latest_version}/${artifact} -o /tmp/deterministic-zip.${_pid} _ok echo -n "Installing to /usr/local/bin ..." - $SUDO mv /tmp/deterministic-zip /usr/local/bin/deterministic-zip + $SUDO mv /tmp/deterministic-zip.${_pid} /usr/local/bin/deterministic-zip $SUDO chmod +x /usr/local/bin/deterministic-zip _ok }