#!/bin/bash
# make sure the script is being run as root
/usr/local/bin/chkroot && [[ $? = 0 ]] || exit 1
# define script variables
dlonly=
fsync=
noconf=
list=0
# get optoins
args=`getopt dlny $*`
set -- $args
for i; do
case "$1" in
-d) dlonly="-w" ; shift ;;
-l) list=1 ; shift ;;
-n) noconf="--noconfirm" ; shift ;;
-y) fsync="-y" ; shift ;;
--) shift ; break ;;
esac
done
pacman -Sy $fsync
[[ "$?" = "0" ]] || exit 1
if [[ "$list" = "1" ]]; then
pacman -Qu --dbpath /var/lib/pacman
exit 0
fi
pacman -Su $dlonly $noconf
echo "Sync ABS? [Y/n]"
read sync_abs
if [[ "$sync_abs" != {"N","n"} ]]; then
abs
fi
echo; echo "updating mlocate database"
updatedb
exit 0
# make sure the script is being run as root
/usr/local/bin/chkroot && [[ $? = 0 ]] || exit 1
# define script variables
dlonly=
fsync=
noconf=
list=0
# get optoins
args=`getopt dlny $*`
set -- $args
for i; do
case "$1" in
-d) dlonly="-w" ; shift ;;
-l) list=1 ; shift ;;
-n) noconf="--noconfirm" ; shift ;;
-y) fsync="-y" ; shift ;;
--) shift ; break ;;
esac
done
pacman -Sy $fsync
[[ "$?" = "0" ]] || exit 1
if [[ "$list" = "1" ]]; then
pacman -Qu --dbpath /var/lib/pacman
exit 0
fi
pacman -Su $dlonly $noconf
echo "Sync ABS? [Y/n]"
read sync_abs
if [[ "$sync_abs" != {"N","n"} ]]; then
abs
fi
echo; echo "updating mlocate database"
updatedb
exit 0