From 6b4ea072547b15aa100e2b78c3a7e8bd71ffd12f Mon Sep 17 00:00:00 2001 From: Krizsan Peter Date: Thu, 21 Mar 2024 22:49:18 +0100 Subject: [PATCH] Script file to prevent upgrading existing packages --- rmscripts.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 rmscripts.sh diff --git a/rmscripts.sh b/rmscripts.sh new file mode 100755 index 0000000..cc4d182 --- /dev/null +++ b/rmscripts.sh @@ -0,0 +1,25 @@ +#! /bin/bash +# first parameter is the blfs tool's script folder +# second parameter is the blfs tool's installed packages xml file + +if [ -z "$1" ] +then + echo "Please specify the blfs tool's script folder as the first argument!" + exit -1 +fi + +if [ -z "$2" ] +then + echo "Please specify the blfs tool's installed packages xml file as the second argument!" + exit -1 +fi + +if [[ "$1" != */ ]] +then + SCRIPTPATH=$(echo "$1"/) +else + SCRIPTPATH="$1" +fi + +grep "$2" -f <(ls "$SCRIPTPATH" | awk -F'-z-' '{print ""$2""}') | while read line ; do rm -v "$SCRIPTPATH"$(echo "$line" | sed 's//*-/g' | sed 's|||g') ; done +