--- a/lib/Tools/components Mon Dec 31 14:58:21 2012 +0100
+++ b/lib/Tools/components Mon Dec 31 15:56:17 2012 +0100
@@ -15,6 +15,7 @@
echo "Usage: isabelle $PRG [OPTIONS] [COMPONENTS ...]"
echo
echo " Options are:"
+ echo " -I init user settings"
echo " -R URL component repository (default \$ISABELLE_COMPONENT_REPOSITORY)"
echo " -a all missing components"
echo " -l list status"
@@ -38,13 +39,17 @@
#options
+INIT_SETTINGS=""
COMPONENT_REPOSITORY="$ISABELLE_COMPONENT_REPOSITORY"
ALL_MISSING=""
LIST_ONLY=""
-while getopts "R:al" OPT
+while getopts "IR:al" OPT
do
case "$OPT" in
+ I)
+ INIT_SETTINGS="true"
+ ;;
R)
COMPONENT_REPOSITORY="$OPTARG"
;;
@@ -65,7 +70,7 @@
# args
-[ "$#" -eq 0 -a -z "$ALL_MISSING" -a -z "$LIST_ONLY" ] && usage
+[ "$#" -eq 0 -a -z "$INIT_SETTINGS" -a -z "$ALL_MISSING" -a -z "$LIST_ONLY" ] && usage
if [ -z "$ALL_MISSING" ]; then
splitarray ":" "$@"
@@ -80,7 +85,23 @@
splitarray ":" "$ISABELLE_COMPONENTS"; declare -a AVAILABLE_COMPONENTS=("${SPLITARRAY[@]}")
splitarray ":" "$ISABELLE_COMPONENTS_MISSING"; declare -a MISSING_COMPONENTS=("${SPLITARRAY[@]}")
-if [ -n "$LIST_ONLY" ]; then
+if [ -n "$INIT_SETTINGS" ]; then
+ SETTINGS="$ISABELLE_HOME_USER/etc/settings"
+ SETTINGS_CONTENT='init_components "$USER_HOME/.isabelle/contrib" "$ISABELLE_HOME/Admin/components/main"'
+ if [ -e "$SETTINGS" ]; then
+ echo "User settings file already exists!"
+ echo
+ echo "Edit \"$SETTINGS\" manually"
+ echo "and add the following line near its start:"
+ echo
+ echo " $SETTINGS_CONTENT"
+ echo
+ else
+ echo "Initializing \"$SETTINGS\""
+ mkdir -p "$(dirname "$SETTINGS")"
+ echo "$SETTINGS_CONTENT" > "$SETTINGS"
+ fi
+elif [ -n "$LIST_ONLY" ]; then
echo
echo "Available components:"
for NAME in "${AVAILABLE_COMPONENTS[@]}"; do echo " $NAME"; done