set -e
OPTIONS=
+AURHELP=
+
+if [[ ${UID} = 0 ]]; then
+ pacman=pacman
+elif [[ -n ${AURHELP} ]]; then
+ pacman=${AURHELP}
+else
+ pacman=pacman
+fi
# List option
installed=false
_usage () {
- :
+ echo "usage ${0} [options] [command] [packages]"
+ echo " commands: "
+ echo " install Install the specified package."
+ echo " remove Remove the specified package."
+ echo " purge Permanently remove the package."
+ echo " update Update the package database."
+ echo " upgrade Update the package."
+ echo " search Search for a package."
+ echo " autoremove Remove unnecessary packages."
+ echo " list Displays a list of packages."
+ echo
+ echo " general options: "
+ echo " -y | --yes | --assume-yes Do not check."
+ echo " -d | --download-only Only download the package."
+ echo " -c <file> Config file for pacman."
+ echo " -h | --help Display this help."
+ echo " -v Displays the version of pacman."
+ echo " --purge Delete the entire configuration file."
}
_exit () {
OPTIONS="${OPTIONS} ${@}"
}
-while getopts 'ydf-:' arg; do
+while getopts 'ydf-:c:hv' arg; do
case "${arg}" in
y) ADD_OPTION "--noconfirm" ;;
d) ADD_OPTION "-w" ;;
f) : ;;
+ c) ADD_OPTION "--config ${OPTARG}" ;;
+ h) _usage; _exit 0 ;;
+ v) _version; _exit 0 ;;
-)
case "${OPTARG}" in
download-only) ADD_OPTION "-w" ;;
fix-broken) :;;
yes) ADD_OPTION "--noconfirm" ;;
assume-yes) ADD_OPTION "--noconfirm" ;;
- installed) installed=true;
+ installed) installed=true;;
+ purge) ADD_OPTION "-n" ;;
+ help) _usage; _exit 0 ;;
esac
esac
done
update) ADD_OPTION "-Syy" ;;
upgrade) ADD_OPTION "-Syu" ;;
search) ADD_OPTION "-Ss" ;;
+ full-upgrade) ADD_OPTION "-Syu" ;;
+ edit-sources) sudo nano /etc/pacman.conf; _exit 0 ;;
+ dist-upgrade) ADD_OPTION "-Syu" ;;
+ autoremove) ADD_OPTION "-Qttdq | pacman -Rsnc -" ;;
list)
if ${installed}; then
ADD_OPTION "-Q | grep"
;;
esac
-echo "pacman ${OPTIONS} ${PACKAGE}"
\ No newline at end of file
+# echo "${pacman} ${OPTIONS} ${PACKAGE}"
+${pacman} ${OPTIONS} ${PACKAGE}
\ No newline at end of file