mirror of
https://github.com/moparisthebest/pkgsync
synced 2024-11-24 18:22:20 -05:00
Make blacklist apply to remove also, add options to add to exclude/blacklist lists during execution
This commit is contained in:
parent
67dfcc1722
commit
38f6e66f92
@ -1,5 +1,7 @@
|
|||||||
# these are packages in the installed list that
|
# these are packages in the installed list that
|
||||||
# you explicitly do not want on this system
|
# you explicitly do not want on this system
|
||||||
|
# or packages in the remove list that you do
|
||||||
|
# not want removed from this system
|
||||||
|
|
||||||
# not acceptable for vegans
|
# not acceptable for vegans
|
||||||
#bison
|
#bison
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#EXCLUSION_LIST=/etc/pkgsync/pkg_exclude.list
|
#EXCLUSION_LIST=/etc/pkgsync/pkg_exclude.list
|
||||||
|
|
||||||
# packages in shared install list to not install on this system
|
# packages in shared install list to not install on this system
|
||||||
|
# or packages in shared remove list to not remove from this system
|
||||||
#BLACKLIST_LIST=/etc/pkgsync/pkg_blacklist.list
|
#BLACKLIST_LIST=/etc/pkgsync/pkg_blacklist.list
|
||||||
|
|
||||||
# packages to remove from all systems, you must sync it between systems
|
# packages to remove from all systems, you must sync it between systems
|
||||||
|
27
pkgsync
27
pkgsync
@ -21,13 +21,13 @@ grep -v '^#' "$REMOVE_LIST" 2>/dev/null | sort -u > "$TMP_DIR/pkg_remove.list
|
|||||||
grep -v '^#' "$INSTALL_LIST" 2>/dev/null | sort -u > "$TMP_DIR/pkg_install.list" || true
|
grep -v '^#' "$INSTALL_LIST" 2>/dev/null | sort -u > "$TMP_DIR/pkg_install.list" || true
|
||||||
|
|
||||||
# get our explicitly installed packages, minus hardware-specific exclusions
|
# get our explicitly installed packages, minus hardware-specific exclusions
|
||||||
pacman -Q | awk '{print $1}' | sort | comm -23 - "$TMP_DIR/pkg_exclude.list" > "$TMP_DIR/mypkgs_with_exclusions.txt"
|
pacman -Qq | sort | comm -23 - "$TMP_DIR/pkg_exclude.list" > "$TMP_DIR/mypkgs_with_exclusions.txt"
|
||||||
|
|
||||||
# exclude packages to remove
|
# exclude packages to remove
|
||||||
comm -23 "$TMP_DIR/mypkgs_with_exclusions.txt" "$TMP_DIR/pkg_remove.list" > "$TMP_DIR/mypkgs_with_exclusions_without_remove.txt"
|
comm -23 "$TMP_DIR/mypkgs_with_exclusions.txt" "$TMP_DIR/pkg_remove.list" > "$TMP_DIR/mypkgs_with_exclusions_without_remove.txt"
|
||||||
|
|
||||||
# list of packages to remove
|
# list of packages to remove, with our blacklist excluded
|
||||||
comm -12 "$TMP_DIR/mypkgs_with_exclusions.txt" "$TMP_DIR/pkg_remove.list" > "$TMP_DIR/pkg_toremove.list"
|
comm -12 "$TMP_DIR/mypkgs_with_exclusions.txt" "$TMP_DIR/pkg_remove.list" | comm -23 - "$TMP_DIR/pkg_blacklist.list" > "$TMP_DIR/pkg_toremove.list"
|
||||||
|
|
||||||
# combine our packages with shared installed list, excluding remove
|
# combine our packages with shared installed list, excluding remove
|
||||||
sort -u "$TMP_DIR/mypkgs_with_exclusions_without_remove.txt" "$TMP_DIR/pkg_install.list" | comm -23 - "$TMP_DIR/pkg_remove.list" > "$TMP_DIR/pkg_installed.list"
|
sort -u "$TMP_DIR/mypkgs_with_exclusions_without_remove.txt" "$TMP_DIR/pkg_install.list" | comm -23 - "$TMP_DIR/pkg_remove.list" > "$TMP_DIR/pkg_installed.list"
|
||||||
@ -42,42 +42,45 @@ comm -23 "$TMP_DIR/pkg_installed.list" "$TMP_DIR/pkg_install.list" > "$TMP_DIR/p
|
|||||||
if [ -s "$TMP_DIR/pkg_toinstall.list" ]
|
if [ -s "$TMP_DIR/pkg_toinstall.list" ]
|
||||||
then
|
then
|
||||||
yn=l
|
yn=l
|
||||||
while [[ ! "$yn" =~ ^[YyNnAa]$ ]]
|
while [[ ! "$yn" =~ ^[YyNnAaQqBb]$ ]]
|
||||||
do
|
do
|
||||||
read -p "Install new packages? (yes/no/list/abort)..." -n 1 yn
|
read -p "Install new packages? (yes/no/list/abort/blacklist)..." -n 1 yn
|
||||||
echo
|
echo
|
||||||
[[ "$yn" =~ ^[Ll]$ ]] && cat "$TMP_DIR/pkg_toinstall.list"
|
[[ "$yn" =~ ^[Ll]$ ]] && cat "$TMP_DIR/pkg_toinstall.list"
|
||||||
done
|
done
|
||||||
[[ "$yn" =~ ^[Yy]$ ]] && pacman -S --needed --confirm - < "$TMP_DIR/pkg_toinstall.list"
|
[[ "$yn" =~ ^[Yy]$ ]] && pacman -S --needed --confirm - < "$TMP_DIR/pkg_toinstall.list"
|
||||||
[[ "$yn" =~ ^[Aa]$ ]] && exit 1
|
[[ "$yn" =~ ^[Bb]$ ]] && cat "$TMP_DIR/pkg_toinstall.list" >> "$BLACKLIST_LIST"
|
||||||
|
[[ "$yn" =~ ^[AaQq]$ ]] && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# offer to remove packages
|
# offer to remove packages
|
||||||
if [ -s "$TMP_DIR/pkg_toremove.list" ]
|
if [ -s "$TMP_DIR/pkg_toremove.list" ]
|
||||||
then
|
then
|
||||||
yn=l
|
yn=l
|
||||||
while [[ ! "$yn" =~ ^[YyNnAa]$ ]]
|
while [[ ! "$yn" =~ ^[YyNnAaQqBb]$ ]]
|
||||||
do
|
do
|
||||||
read -p "Remove packages? (yes/no/list/abort)..." -n 1 yn
|
read -p "Remove packages? (yes/no/list/abort/blacklist)..." -n 1 yn
|
||||||
echo
|
echo
|
||||||
[[ "$yn" =~ ^[Ll]$ ]] && cat "$TMP_DIR/pkg_toremove.list"
|
[[ "$yn" =~ ^[Ll]$ ]] && cat "$TMP_DIR/pkg_toremove.list"
|
||||||
done
|
done
|
||||||
[[ "$yn" =~ ^[Yy]$ ]] && pacman -Ru --confirm - < "$TMP_DIR/pkg_toremove.list"
|
[[ "$yn" =~ ^[Yy]$ ]] && pacman -Ru --confirm - < "$TMP_DIR/pkg_toremove.list"
|
||||||
[[ "$yn" =~ ^[Aa]$ ]] && exit 1
|
[[ "$yn" =~ ^[Bb]$ ]] && cat "$TMP_DIR/pkg_toremove.list" >> "$BLACKLIST_LIST"
|
||||||
|
[[ "$yn" =~ ^[AaQq]$ ]] && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# offer to update install list, if it changed
|
# offer to update install list, if it changed
|
||||||
if [ -s "$TMP_DIR/pkg_ourinstall.list" ]
|
if [ -s "$TMP_DIR/pkg_ourinstall.list" ]
|
||||||
then
|
then
|
||||||
yn=l
|
yn=l
|
||||||
while [[ ! "$yn" =~ ^[YyNnAa]$ ]]
|
while [[ ! "$yn" =~ ^[YyNnAaQqEe]$ ]]
|
||||||
do
|
do
|
||||||
read -p "Append packages unique to this computer to install list and run finish script? (yes/no/list/abort)..." -n 1 yn
|
read -p "Append packages unique to this computer to install list and run finish script? (yes/no/list/abort/exclude)..." -n 1 yn
|
||||||
echo
|
echo
|
||||||
[[ "$yn" =~ ^[Ll]$ ]] && cat "$TMP_DIR/pkg_ourinstall.list"
|
[[ "$yn" =~ ^[Ll]$ ]] && cat "$TMP_DIR/pkg_ourinstall.list"
|
||||||
done
|
done
|
||||||
[[ "$yn" =~ ^[Yy]$ ]] && cat "$TMP_DIR/pkg_ourinstall.list" >> "$INSTALL_LIST"
|
[[ "$yn" =~ ^[Yy]$ ]] && cat "$TMP_DIR/pkg_ourinstall.list" >> "$INSTALL_LIST"
|
||||||
[[ "$yn" =~ ^[Aa]$ ]] && exit 1
|
[[ "$yn" =~ ^[Ee]$ ]] && cat "$TMP_DIR/pkg_ourinstall.list" >> "$EXCLUSION_LIST"
|
||||||
|
[[ "$yn" =~ ^[AaQq]$ ]] && exit 1
|
||||||
[ -x "$FINISH_SCRIPT" ] && "$FINISH_SCRIPT"
|
[ -x "$FINISH_SCRIPT" ] && "$FINISH_SCRIPT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user