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"
34 DEFAULT_PACMAN_COMMAND="pacman"
37 PACMAN_COMMAND="${DEFAULT_PACMAN_COMMAND}"
50 if [[ ! "${UID}" = 0 ]]; then
51 if [[ -z "${AURHELPER}" ]]; then
52 for AURHELPER in ${HELPERS[@]}; do
53 if [[ -f "${AURHELPER}" ]]; then
54 PACMAN_COMMAND="${AURHELPER}"
56 elif hash "$(basename "${AURHELPER}")" 2> /dev/null; then
57 PACMAN_COMMAND="$(basename "${AURHELPER}")"
61 if [[ "${PACMAN_COMMAND}" == "${DEFAULT_PACMAN_COMMAND}" ]]; then
62 PACMAN_COMMAND="sudo ${DEFAULT_PACMAN_COMMAND}"
65 if [[ -f "${AURHELPER}" ]]; then
66 PACMAN_COMMAND="${AURHELPER}"
67 elif hash "$(basename "${AURHELPER}")" 2> /dev/null; then
68 PACMAN_COMMAND="$(basename "${AURHELPER}")"
70 _msg_error "${AURHELPER} is not installed."
81 echo "usage ${0} [options] [command] [packages]"
83 echo " install Install the specified package."
84 echo " remove Remove the specified package."
85 echo " purge Permanently remove the package."
86 echo " update Update the package database."
87 echo " upgrade Update the package."
88 echo " search Search for a package."
89 echo " autoremove Remove unnecessary packages."
90 echo " clean Remove the package cache."
91 echo " list Displays a list of packages."
93 echo " general options: "
94 echo " -y | --yes | --assume-yes Do not check."
95 echo " -d | --download-only Only download the package."
96 echo " -c <file> Config file for pacman."
97 echo " -h | --help Display this help."
98 echo " -v | --version Displays the version of aptpac and pacman."
99 echo " --purge Delete the entire configuration file."
108 aptpac ${APTPAC_VERSION} - A pacman wrapper with syntax based on debian's apt
109 License: Do What The Fuck You Want To Public License
110 (c) 2019-2020 Fascode Network. Yamada Hayao
118 PACMAN_OPTIONS="${PACMAN_OPTIONS} ${@}"
121 # Argument analysis and processing
123 _opt_long="yes,assume-yes,download-only,fix-broken,purse,installed,debug,help,version"
124 OPT=$(getopt -o ${_opt_short} -l ${_opt_long} -- "${@}")
125 if [[ ${?} != 0 ]]; then
130 #echo "Argument is \"${OPT}\""
131 unset OPT _opt_short _opt_long
135 -y | --yes | --assume-yes)
136 ADD_OPTION "--noconfirm"
139 -d | --download-only)
147 ADD_OPTION "--config ${2}"
177 _msg_error "Invalid argument '${1}'"
184 if [[ $# -lt 1 ]]; then
185 _msg_error "No command specified"
196 install) ADD_OPTION "-S" ;;
197 remove) ADD_OPTION "-Rsc" ;;
198 purge) ADD_OPTION "-Rsnc" ;;
199 update) ADD_OPTION "-Syy" ;;
200 upgrade) ADD_OPTION "-Syu" ;;
201 search) ADD_OPTION "-Ss" ;;
202 full-upgrade) ADD_OPTION "-Syu" ;;
203 edit-sources) sudo nano /etc/pacman.conf; _exit 0 ;;
204 dist-upgrade) ADD_OPTION "-Syu" ;;
206 source "/etc/locale.conf"
207 if [[ "${LANG}" = "ja_JP.UTF-8" ]]; then
208 echo "(ง •ᴗ•)ว ⁾⁾ファーウェイでウェイウェイ"
211 _msg_error "Invalid command '${COMMAND}'"
223 ...."Have you mooed today?"...
230 autoremove) if [[ -n $(${PACMAN_COMMAND} -Qttdq) ]]; then
232 PACKAGE="$(${PACMAN_COMMAND} -Qttdq)"
234 echo "No packages to remove."
239 if ${installed}; then
240 ADD_OPTION "-Q | grep"
246 _msg_error "Invalid command '${COMMAND}'"
251 if [[ ! "${PACMAN_COMMAND}" = "pacman" ]] && [[ ! "${PACMAN_COMMAND}" = "sudo pacman" ]]; then
252 _msg_debug "Use AUR helper ${PACMAN_COMMAND}."
255 # echo "${PACMAN_COMMAND} ${PACMAN_OPTIONS} ${PACKAGE}"
256 ${PACMAN_COMMAND} ${PACMAN_OPTIONS} ${PACKAGE}