This repository has been archived by the owner. It is now read-only.
Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (66 sloc) 1.89 KB
#!/bin/sh
# The `rpg-config` program dumps configuration variables to standard output
# in a format suitable for sourcing into a shell or opens an editor on rpg
# configuration files.
set -e
. rpg-sh-setup
ARGV="$@"
USAGE '${PROGNAME}
${PROGNAME} -u
${PROGNAME} -s
Show or edit rpg configuration.
Options
-u Edit the user configuration file
-s Edit the system configuration file
'
# With `-u` or `-s`, open an editor on the configuration file. If the file
# doesn't exist, create it with the program's current output but comment out
# all variable assignment lines.
editfile=
while getopts su opt
do
case $opt in
s) editfile="$RPGSYSCONF";;
u) editfile="$RPGUSERCONF";;
?) helpthem;exit 2;;
esac
done
shift $(( $OPTIND - 1 ))
test -n "$editfile" && {
test -f "$editfile" || {
{
echo "# $(date)"
echo "# This file was generated by "$PROGNAME" on" \
"behalf of $(id -un)"
echo "# Remove comment characters and edit values to" \
"change the default config"
echo
"$0"
} |sed 's/^\([^#]\)/# \1/' >"$editfile"
}
${EDITOR:-vi} "$editfile"
exit $?
}
# Dump config values with some comments so we can use it to generate
# config files in edit mode.
cat <<CONFIG
# rpg installs package contents in these locations:
RPGBIN='$RPGBIN'
RPGLIB='$RPGLIB'
RPGMAN='$RPGMAN'
# rpg keeps its package database, index, and gem cache in these locations:
RPGPATH='$RPGPATH'
RPGDB='$RPGDB'
RPGINDEX='$RPGINDEX'
RPGPACKS='$RPGPACKS'
RPGCACHE='$RPGCACHE'
# rpg sources these configuration files before executing commands:
RPGSYSCONF='$RPGSYSCONF'
RPGUSERCONF='$RPGUSERCONF'
# rpg uses these options to control various aspects of its behavior:
RPGTRACE=$RPGTRACE
RPGSHOWBUILD=$RPGSHOWBUILD
RPGSTALETIME='$RPGSTALETIME'
RPGSPECSURL='$RPGSPECSURL'
RPGGEMURL='$RPGGEMURL'
CONFIG