mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
Add subcmd checkdeps
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Check whether pkgs exist in AUR or repos of Arch.
|
||||
#
|
||||
# Do NOT abuse this since it consumes extra bandwidth from AUR server.
|
||||
|
||||
pkglistfile=$(mktemp)
|
||||
pkglistfile_orig=${LIST_FILE_PATH}
|
||||
mkdir -p ./cache
|
||||
pkglistfile_orig_s=./cache/dependencies_stripped.conf
|
||||
remove_bashcomments_emptylines $pkglistfile_orig $pkglistfile_orig_s
|
||||
|
||||
cat $pkglistfile_orig_s | sed "s_\ _\n_g" > $pkglistfile
|
||||
|
||||
echo "The non-existent pkgs in $pkglistfile_orig are listed as follows."
|
||||
# Borrowed from https://bbs.archlinux.org/viewtopic.php?pid=1490795#p1490795
|
||||
comm -23 <(sort -u $pkglistfile) <(sort -u <(wget -q -O - https://aur.archlinux.org/packages.gz | gunzip) <(pacman -Ssq))
|
||||
echo "End of list. If nothing appears, then all pkgs exist."
|
||||
rm $pkglistfile
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# Handle args for subcmd: exp-uninstall
|
||||
# shellcheck shell=bash
|
||||
|
||||
showhelp(){
|
||||
echo -e "Syntax: $0 checkdeps [OPTIONS]...
|
||||
|
||||
Experimental unintallation.
|
||||
|
||||
Options:
|
||||
-h, --help Show this help message
|
||||
--file A file in plain text containing package names
|
||||
"
|
||||
}
|
||||
# `man getopt` to see more
|
||||
para=$(getopt \
|
||||
-o h \
|
||||
-l help,file: \
|
||||
-n "$0" -- "$@")
|
||||
[ $? != 0 ] && echo "$0: Error when getopt, please recheck parameters." && exit 1
|
||||
#####################################################################################
|
||||
## getopt Phase 1
|
||||
# ignore parameter's order, execute options below first
|
||||
eval set -- "$para"
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-h|--help) showhelp;exit;;
|
||||
--) break ;;
|
||||
*) shift ;;
|
||||
esac
|
||||
done
|
||||
#####################################################################################
|
||||
## getopt Phase 2
|
||||
|
||||
eval set -- "$para"
|
||||
while true ; do
|
||||
case "$1" in
|
||||
## Ones with parameter
|
||||
--file)
|
||||
if [[ -f "$2" ]];
|
||||
then echo "Using list file \"$2\".";LIST_FILE_PATH="$2";shift 2
|
||||
else echo "Wrong argument for $1.";exit 1
|
||||
fi;;
|
||||
|
||||
## Ending
|
||||
--) break ;;
|
||||
*) echo -e "$0: Wrong parameters.";exit 1;;
|
||||
esac
|
||||
done
|
||||
@@ -24,6 +24,7 @@ Subcommands:
|
||||
exp-uninstall (Experimental) Uninstall illogical-impulse.
|
||||
exp-update (Experimental) Update illogical-impulse without fully reinstall.
|
||||
exp-update-old (Experimental) exp-update but use behaves like old version.
|
||||
checkdeps (For dev only) Check whether pkgs exist in AUR or repos of Arch.
|
||||
help Show this help message.
|
||||
|
||||
For each <subcommand>, use -h for details:
|
||||
@@ -34,7 +35,7 @@ case $1 in
|
||||
# Global help
|
||||
help|--help|-h)showhelp_global;exit;;
|
||||
# Correct subcommand
|
||||
install|exp-uninstall|exp-update|exp-update-old)
|
||||
install|exp-uninstall|exp-update|exp-update-old|checkdeps)
|
||||
SUBCMD_NAME=$1
|
||||
SUBCMD_DIR=./sdata/subcmd-$1
|
||||
shift;;
|
||||
|
||||
Reference in New Issue
Block a user