5 # __ _____\ \ ,_\ _____ __ ___
6 # /'__`\ /\ '__`\ \ \//\ '__`\ /'__`\ /'___\
7 #/\ \L\.\\ \ \L\ \ \ \\ \ \L\ /\ \L\.\_/\ \__/
8 #\ \__/.\_\ \ ,__/\ \__\ \ ,__\ \__/.\_\ \____\
9 # \/__/\/_/\ \ \/ \/__/\ \ \/ \/__/\/_/\/____/
12 # a pacman wrapper with syntax based on debian's apt
13 # (c) 2019-2020 Fascode Network.
14 # License: Do What The Fuck You Want To Public License
15 # maintained by Yamada Hayao
17 # Enter the path to the AUR helper you want to use here.
18 # If it is empty, the corresponding AUR helper will be searched automatically.
24 APTPAC_VERSION="3.0.1"
33 DEFAULT_PACMAN_COMMAND="/usr/bin/pacman"
35 PACMAN_COMMAND="${DEFAULT_PACMAN_COMMAND}"
48 if [[ ! "${UID}" = 0 ]]; then
49 if [[ -z "${AURHELPER}" ]]; then
50 for AURHELPER in ${HELPERS[@]}; do
51 if [[ -f "${AURHELPER}" ]]; then
52 PACMAN_COMMAND="${AURHELPER}"
54 elif hash "$(basename "${AURHELPER}")" 2> /dev/null; then
55 PACMAN_COMMAND="$(basename "${AURHELPER}")"
59 if [[ "${PACMAN_COMMAND}" == "${DEFAULT_PACMAN_COMMAND}" ]]; then
60 PACMAN_COMMAND="sudo ${DEFAULT_PACMAN_COMMAND}"
63 if [[ -f "${AURHELPER}" ]]; then
64 PACMAN_COMMAND="${AURHELPER}"
65 elif hash "$(basename "${AURHELPER}")" 2> /dev/null; then
66 PACMAN_COMMAND="$(basename "${AURHELPER}")"
68 _msg_error "${AURHELPER} is not installed"
79 echo "usage ${0} [options] [command] [packages]"
81 echo " install Install the specified package"
82 echo " remove Remove the specified package"
83 echo " purge Permanently remove the package"
84 echo " update Update the package database"
85 echo " upgrade Update the package"
86 echo " full-upgrade Update packages and remove unnecessary packages"
87 echo " search Search for a package"
88 echo " autoremove Remove unnecessary packages"
89 echo " clean Remove the package cache"
90 echo " list Displays a list of packages"
92 echo " general options: "
93 echo " -y | --yes | --assume-yes Do not check"
94 echo " -d | --download-only Only download the package"
95 echo " -c <file> Config file for pacman"
96 echo " -h | --help Display this help"
97 echo " -v | --version Displays the version of aptpac and pacman"
98 echo " --purge Delete the entire configuration file"
107 aptpac ${APTPAC_VERSION} - A pacman wrapper with syntax based on debian's apt
108 License: Do What The Fuck You Want To Public License
109 (c) 2019-2020 Fascode Network. Yamada Hayao
117 PACMAN_OPTIONS="${PACMAN_OPTIONS} ${@}"
120 # Argument analysis and processing
122 _opt_long="yes,assume-yes,download-only,fix-broken,purse,installed,debug,help,version"
123 OPT=$(getopt -o ${_opt_short} -l ${_opt_long} -- "${@}")
124 if [[ ${?} != 0 ]]; then
129 #echo "Argument is \"${OPT}\""
130 unset OPT _opt_short _opt_long
134 -y | --yes | --assume-yes)
135 ADD_OPTION "--noconfirm"
138 -d | --download-only)
146 ADD_OPTION "--config ${2}"
176 _msg_error "Invalid argument '${1}'"
183 if [[ $# -lt 1 ]]; then
184 _msg_error "No command specified"
195 install) ADD_OPTION "-S" ;;
196 remove) ADD_OPTION "-Rsc" ;;
197 purge) ADD_OPTION "-Rsnc" ;;
198 update) ADD_OPTION "-Syy" ;;
199 upgrade) ADD_OPTION "-Syu" ;;
200 search) ADD_OPTION "-Ss" ;;
201 full-upgrade) ADD_OPTION "-Syu" ;;
202 edit-sources) sudo nano /etc/pacman.conf; _exit 0 ;;
203 dist-upgrade) ADD_OPTION "-Syu" ;;
205 source "/etc/locale.conf"
206 if [[ "${LANG}" = "ja_JP.UTF-8" ]]; then
207 echo "(ง •ᴗ•)ว ⁾⁾ファーウェイでウェイウェイ"
210 _msg_error "Invalid command '${COMMAND}'"
222 ...."Have you mooed today?"...
229 autoremove) if [[ -n $(${PACMAN_COMMAND} -Qttdq) ]]; then
231 PACKAGE="$(${PACMAN_COMMAND} -Qttdq)"
233 echo "No packages to remove"
238 if ${installed}; then
239 ADD_OPTION "-Q | grep"
245 _msg_error "Invalid command '${COMMAND}'"
250 if [[ ! "${PACMAN_COMMAND}" = "pacman" ]] && [[ ! "${PACMAN_COMMAND}" = "sudo pacman" ]]; then
251 _msg_debug "Use AUR helper ${PACMAN_COMMAND}"
254 # echo "${PACMAN_COMMAND} ${PACMAN_OPTIONS} ${PACKAGE}"
255 ${PACMAN_COMMAND} ${PACMAN_OPTIONS} ${PACKAGE}