gentooup.sh: add option to disable locking
This commit is contained in:
parent
9a27a6a7f6
commit
fe76b1fe4e
1 changed files with 15 additions and 8 deletions
23
gentooup.sh
23
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
|
||||
|
|
Loading…
Add table
Reference in a new issue