OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

74 lines
1.9 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: lib/sde-clean/config.in
# Copyright (C) 2006 - 2007 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
#Description: Removed specified configurations (items).
#Alias: cfg
# 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