Scripts: abs-wrapper can now clean archives.

master
Pierre Neidhardt 2013-07-13 18:21:00 +02:00
parent 2d6fac0b85
commit 83737d15fd
2 changed files with 21 additions and 3 deletions

View File

@ -1,7 +1,6 @@
amscls amscls
amsmath amsmath
babel babel
beamer
bigfoot bigfoot
carlisle carlisle
easylist easylist

View File

@ -27,7 +27,8 @@ available.
Options: Options:
-b: Build. -b: Build.
-c: Clean source folders from temp file (keep upstream source and built package). -c: Clean source folders from temp file (keep upstream source and package folder).
-C: Clean source folders from archives.
-f: Force operation (overwrite, rebuild, reinstall). -f: Force operation (overwrite, rebuild, reinstall).
-h: Display this help. -h: Display this help.
-i: Install package. -i: Install package.
@ -54,17 +55,20 @@ PACMAN_OPT="--needed"
OPT_BUILD=false OPT_BUILD=false
OPT_CLEAN=false OPT_CLEAN=false
OPT_MRPROPER=false
OPT_FORCE=false OPT_FORCE=false
OPT_INSTALL=false OPT_INSTALL=false
OPT_SOURCE=false OPT_SOURCE=false
while getopts ":bcfhis" opt; do while getopts ":bcCfhis" opt; do
case $opt in case $opt in
b) b)
OPT_BUILD=true ;; OPT_BUILD=true ;;
c) c)
MAKEPKG_OPT="$MAKEPKG_OPT -c" MAKEPKG_OPT="$MAKEPKG_OPT -c"
OPT_CLEAN=true ;; OPT_CLEAN=true ;;
C)
OPT_MRPROPER=true ;;
f) f)
MAKEPKG_OPT="$MAKEPKG_OPT -f" MAKEPKG_OPT="$MAKEPKG_OPT -f"
PACMAN_OPT="" PACMAN_OPT=""
@ -170,6 +174,14 @@ abs_clean ()
rm -rf "src" "pkg") rm -rf "src" "pkg")
} }
abs_mrproper ()
{
(cd "$1" && \
echo "Removing archives." && \
rm -v *.tar.gz *.tar.xz *.tar.bz *.tar.bz2 *.tgz *.txz *.tbz *.tbz2 2>/dev/null)
}
abs_install () abs_install ()
{ {
sudo sh -c ' sudo sh -c '
@ -181,6 +193,8 @@ abs_install ()
} }
for i ; do for i ; do
echo "==> Processing $i."
## Fetch PKGBUILD. ## Fetch PKGBUILD.
if [ ! -f "$i/PKGBUILD" ] || $OPT_FORCE; then if [ ! -f "$i/PKGBUILD" ] || $OPT_FORCE; then
abs_pkgbuild "$i" abs_pkgbuild "$i"
@ -203,6 +217,11 @@ for i ; do
if $OPT_CLEAN; then if $OPT_CLEAN; then
abs_clean "$i" abs_clean "$i"
fi fi
## Remove archives.
if $OPT_MRPROPER; then
abs_mrproper "$i"
fi
done done
## Install packages. We put the install part outside the loop so that we prompt ## Install packages. We put the install part outside the loop so that we prompt