Browse Source

Implemented sde clean config

misl/sde-wrapper
Minto van der Sluis 17 years ago
parent
commit
3375ef9aae
1 changed files with 56 additions and 1 deletions
  1. +56
    -1
      lib/sde-clean/config.in

+ 56
- 1
lib/sde-clean/config.in

@ -15,5 +15,60 @@
#Description: Removed specified configurations (items).
#Alias: cfg
echo_abort 1 "Not yet implemented"
# Parse commandline arguments.
dryrun=
force=
confignames=
quiet=
verbose=
while [ "$1" ] ; do
case "$1" in
-n|--dry-run)
dryrun=$1 ;;
-f|--force)
force=$1 ;;
-q|--quiet)
quiet=$1 ;;
-v|--verbose)
verbose=$1 ;;
-*)
echo_abort 1 "Option $1 not recognized" ;;
*)
# The rest of the arguments are config names. But
# first check if there are any confignames.
if [ "$#" == 0 ]; then
# no items specified.
confignames=default
else
# Remaining arguments are items.
confignames=$@
fi
break ;;
esac
shift
done
# Check for mutually exclusive options.
if [ -n "$verbose" -a -n "$quiet" ]; then
# No source config no action.
echo_abort 1 "Options '$verbose' and '$quiet' are mutually exclusive"
fi
# Process every given configname one at a time.
for configname in $confignames; do
cfglocation=$(sde_config_dir $configname)
# Check if the config really exists.
if [ ! -d $cfglocation ]; then
# No config no action, but since the action was removing
# it anyway, we can safely continue with the next one.
echo_warning "Config $configname does not exist"
continue
fi
# Now we can rename the config location
echo_msg "Removing config $configname"
if [ -z "$dryrun" ]; then
rm -rf $verbose $cfglocation
fi
done

Loading…
Cancel
Save