mirror of
https://github.com/edu4rdshl/simpleaur.git
synced 2026-07-17 23:24:46 +00:00
Only allow a instance of simpleaur running at the same time
This commit is contained in:
parent
cf506aaf55
commit
16eb18ee3f
1 changed files with 11 additions and 1 deletions
12
simpleaur
12
simpleaur
|
|
@ -2,7 +2,16 @@
|
|||
# install AUR packages
|
||||
basebuilddir="$HOME/.simpleaur/Build"
|
||||
pacmanexist=$(which pacman 2> /dev/null)
|
||||
lockfile="$basebuilddir/simpleaur.lock"
|
||||
|
||||
#Prevent two instances running at same time
|
||||
if [ -f "$lockfile" ]; then
|
||||
printf "\n\e[1;31m%-6s\e[m%s\n" "simpleaur is running, leaving."
|
||||
printf "\n\e[1;31m%-6s\e[m%s\n" "If you are sure that simpleaur is not running, delete [ '$lockfile' ]"
|
||||
exit
|
||||
else
|
||||
touch "$lockfile"
|
||||
fi
|
||||
#Make sure that you are using an ArchLinux system
|
||||
if [ -x "$pacmanexist" ]; then
|
||||
continue
|
||||
|
|
@ -39,7 +48,6 @@ for ipackage in "$@"; do
|
|||
else
|
||||
git clone "https://aur.archlinux.org/${ipackage}.git"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
|
|
@ -78,3 +86,5 @@ for ipackage in "$@"; do
|
|||
rm -rf "$basebuilddir/$ipackage"
|
||||
fi
|
||||
done
|
||||
rm "$lockfile"
|
||||
exit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue