From fe76b1fe4e16b71a1a9db3a0e274aec9c6622fc1 Mon Sep 17 00:00:00 2001 From: layman Date: Tue, 24 Jan 2023 17:57:37 +0100 Subject: [PATCH] gentooup.sh: add option to disable locking --- gentooup.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/gentooup.sh b/gentooup.sh index 8af4a31..af2be96 100755 --- a/gentooup.sh +++ b/gentooup.sh @@ -1,14 +1,6 @@ #!/bin/bash LOCKFILE=/usr/portage/gentooup.lock -exec {FD_LOCK}<>"$LOCKFILE" -echo "Try to acquire lock for $LOCKFILE" -if ! flock -x -w 60 "$FD_LOCK" ; then - echo "Could not acquire lock for $LOCKFILE" - exit 1 -fi -echo "Lock acquired" - PORTAGE_OPTIONS=("--keep-going" "--autounmask-write" "--binpkg-changed-deps=y" "--autounmask-continue") PORTAGE_UPGRADE_OPTIONS=("-vuNDk") @@ -54,6 +46,11 @@ while [[ $# -gt 0 ]]; do SYNC_COMMAND="" shift ;; + --no-lock) + echo "not locking" + NO_LOCK=1 + shift + ;; --full) echo "Do a full upgrade including build dependencies" PORTAGE_UPGRADE_OPTIONS+=("--with-bdeps=y") @@ -92,6 +89,16 @@ myemerge() { echo "emerge return value: $?" } +if [[ -z "$NO_LOCK" ]] ; then + exec {FD_LOCK}<>"$LOCKFILE" + echo "Try to acquire lock for $LOCKFILE" + if ! flock -x -w 60 "$FD_LOCK" ; then + echo "Could not acquire lock for $LOCKFILE" + exit 1 + fi + echo "Lock acquired" +fi + if [[ -n ${SYNC_COMMAND} ]] ; then ${SYNC_COMMAND} eix-update >& /dev/null