diff options
author | Tiago Porsch Dopke | 2025-02-25 10:39:18 -0300 |
---|---|---|
committer | Tiago Porsch Dopke | 2025-02-25 10:39:18 -0300 |
commit | 8efa0326f2f530f2e7af9fb0000b2d465cd19985 (patch) | |
tree | e6b2ee21aab9da1cbbad23bd744779d7fbafa394 | |
parent | 44790bfff63e071f62ff63b0921276453f7b141b (diff) | |
download | aur-8efa0326f2f530f2e7af9fb0000b2d465cd19985.tar.gz |
Remove source code
-rwxr-xr-x | dpw | 125 | ||||
-rw-r--r-- | dpw.fish | 5 |
2 files changed, 0 insertions, 130 deletions
diff --git a/dpw b/dpw deleted file mode 100755 index 208fc4d53e6d..000000000000 --- a/dpw +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash -set -e - -PKG_FILE="${HOME}/.config/dpw/packages.ini" - -# Check if PACMAN is not set and find an available helper -AUR_HELPERS=("pacaur" "pikaur" "yay" "aura" "paru" "aurman") -if [ -z "${PACMAN}" ]; then - for HELPER in "${AUR_HELPERS[@]}"; do - if command -v "$HELPER" > /dev/null 2>&1; then - PACMAN="$HELPER" - break - fi - done - - if [ -z "${PACMAN}" ]; then - printf "\033[1m::\033[0m No available AUR helper found." - exit 1 - fi -fi - -# Show help menu -if [ "${1}" = "help" ]; then - printf "\033[1m:: \033[1;31mdpw\033[0m - Executes the program normally, using the existing packages.ini or creating a new one if it doesn't exist yet.\n" - printf "\033[1m:: \033[1;31mdpw edit\033[0m - Opens the packages.ini file in the user's selected editor (defined via the EDITOR variable).\n" - printf "\033[1m:: \033[1;31mdpw update\033[0m - Overwrites the current contents of the package.ini file with the currently installed package. Useful after using pacman or paru directly to install new packages.\n" - printf "\033[1m:: \033[1;31mdpw help\033[0m - Shows this menu.\n" - exit -fi - -# Generate packages.ini if it does not exist -if [ ! -e "${PKG_FILE}" ]; then - printf "\033[1m::\033[0m Packages file '%s' does not exist.\n" "${PKG_FILE}" - while true; do - printf "\033[1m::\033[0m Do you wish to generate one using the currently installed packages [Y/n]? " - read -r YN - case ${YN:-Y} in - [Yy]*) - mkdir --parents "${PKG_FILE%/*}" - "${PACMAN}" --query --explicit --quiet > "${PKG_FILE}" - break;; - [Nn]*) - exit;; - esac - done -fi - -# Edit packages.ini -if [ "${1}" = "edit" ]; then - ${EDITOR} "${PKG_FILE}" - exit -fi - -# Update packages.ini -if [ "${1}" = "update" ]; then - while true; do - printf "\033[1m::\033[0m Do you wish to update the currently existing packages.ini [y/N]? " - read -r YN - case ${YN:-N} in - [Yy]*) - "${PACMAN}" --query --explicit --quiet > "${PKG_FILE}" - break;; - [Nn]*) - exit;; - esac - done -fi - - -# Calculate changes -function diff { comm -23 <(echo -n "$1") <(echo -n "$2"); } - -PKG_DECLARED=$(sed 's/#.*$//;s/\s*//g; /./!d' "${PKG_FILE}" | sort --unique) - -PKG_INSTALLED=$("${PACMAN}" -Q --quiet | sort --unique) -PKG_INSTALLED_EXPLICIT=$("${PACMAN}" -Q --quiet --explicit | sort --unique) -PKG_INSTALLED_UNREQUIRED=$("${PACMAN}" -Q --quiet --explicit --unrequired --unrequired | sort --unique) - -PKG_EXPLICIT_NOT_DECLARED=$(diff "${PKG_INSTALLED_EXPLICIT}" "${PKG_DECLARED}") -PKG_MARK_DEPENDENCY=$(diff "${PKG_EXPLICIT_NOT_DECLARED}" "${PKG_INSTALLED_UNREQUIRED}") -PKG_REMOVE=$(diff "${PKG_EXPLICIT_NOT_DECLARED}" "${PKG_MARK_DEPENDENCY}") - -PKG_DECLARED_NOT_EXPLICIT=$(diff "${PKG_DECLARED}" "${PKG_INSTALLED_EXPLICIT}") -PKG_INSTALL=$(diff "${PKG_DECLARED_NOT_EXPLICIT}" "${PKG_INSTALLED}") -PKG_MARK_EXPLICIT=$(diff "${PKG_DECLARED_NOT_EXPLICIT}" "${PKG_INSTALL}") - -# Print summary -if [ -n "${PKG_REMOVE}" ]; then - printf "\033[1m::\033[1;31m Remove\033[0m %s\n" "$(echo "${PKG_REMOVE}" | tr '\n' ' ')" -fi -if [ -n "${PKG_INSTALL}" ]; then - printf "\033[1m::\033[1;32m Install\e[0m %s\n" "$(echo "${PKG_INSTALL}" | tr '\n' ' ')" -fi -if [ -n "${PKG_MARK_DEPENDENCY}" ]; then - printf "\033[1m::\033[1;33m Mark dependency\e[0m %s\n" "$(echo "${PKG_MARK_DEPENDENCY}" | tr '\n' ' ')" -fi -if [ -n "${PKG_MARK_EXPLICIT}" ]; then - printf "\033[1m::\033[1;33m Mark explicit\e[0m %s\n" "$(echo "${PKG_MARK_EXPLICIT}" | tr '\n' ' ')" -fi - -# Do actions -if [ -n "${PKG_REMOVE}" ]; then - "${PACMAN}" --remove --recursive --unneeded ${PKG_REMOVE} -fi -if [ -n "${PKG_INSTALL}" ]; then - "${PACMAN}" --sync ${PKG_INSTALL} -fi -if [ -n "${PKG_MARK_DEPENDENCY}" ]; then - "${PACMAN}" --database --asdeps ${PKG_MARK_DEPENDENCY} -fi -if [ -n "${PKG_MARK_EXPLICIT}" ]; then - "${PACMAN}" --database --asexplicit ${PKG_MARK_EXPLICIT} -fi - -# Check for newly unused dependencies arising from the database changes -PKG_INSTALLED_UNUSED=$("${PACMAN}" -Q --quiet --deps --unrequired --unrequired | sort --unique) - -if [ -n "${PKG_INSTALLED_UNUSED}" ]; then - printf "\033[1m::\033[1;31m Prune\033[0m %s\n" "$(echo "${PKG_INSTALLED_UNUSED}" | tr '\n' ' ')" - "${PACMAN}" --remove --recursive ${PKG_INSTALLED_UNUSED} -fi - -# Do a system upgrade -echo -e "\033[1m::\033[1;36m Upgrade\033[0m all" -"${PACMAN}" --sync --sysupgrade --refresh diff --git a/dpw.fish b/dpw.fish deleted file mode 100644 index bb7ac65f3e28..000000000000 --- a/dpw.fish +++ /dev/null @@ -1,5 +0,0 @@ -set -l dpw_commands help edit update - -complete -f -c dpw -n "not __fish_seen_subcommand_from $dpw_commands" -a help -d "Show the help menu" -complete -f -c dpw -n "not __fish_seen_subcommand_from $dpw_commands" -a edit -d "Open the packages.ini file in the user's selected editor [defined in the EDITOR variable]." -complete -f -c dpw -n "not __fish_seen_subcommand_from $dpw_commands" -a update -d "Overwrite the current contents of the package.ini file with the currently installed packages." |