- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/commands/instances.sh
r24 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 … … 51 52 esac 52 53 done 53 echo54 54 fi 55 configEditAll configQueryValue55 configEditAll 56 56 echo 57 57 configSetAutoParameters "$INSTANCE" … … 75 75 return 76 76 fi 77 77 78 78 if [ $(isRunning "$1") -eq 0 ]; then 79 79 INSTANCE=$1 80 80 loadCurrentConfigValues "$1" 81 82 while : ; do 83 echo "What section of the config do you want to edit?" 84 local i=0 85 local sects=() 86 for S in $(listConfigEditFuncs); do 87 (( i++ )) 88 sects[$i]=$S 89 printf " %2d: %s\n" $i "$S" 90 done 91 echo 92 echo " W: Save and exit" 93 echo " Q: Exit WITHOUT saving" 94 95 local SEC 96 while : ; do 97 read -p "Section number: " SEC 98 SEC=$(lowercase $SEC) 99 if [ $(isANumber $SEC) -eq 1 ]; then 100 if [ $SEC -ge 1 -a $SEC -le $i ]; then 101 break 102 fi 103 else 104 if [ "$SEC" = "q" -o "$SEC" = "w" ]; then 105 break 106 fi 107 fi 108 echo "Not a valid section number!" 109 done 110 echo 111 112 case "$SEC" in 113 q) 114 echo "Not saving" 115 break 116 ;; 117 w) 118 configSetAutoParameters "$INSTANCE" 119 echo "Saving" 120 saveCurrentConfigValues "$1" 121 echo "Done" 122 break 123 ;; 124 *) 125 configEdit${sects[$SEC]} configQueryValue 126 echo 127 esac 128 done 81 configEditAll 82 echo 83 configSetAutoParameters "$INSTANCE" 84 echo 85 echo "Saving" 86 saveCurrentConfigValues "$1" 87 echo "Done" 129 88 else 130 89 echo "Instance $1 is currently running. Please stop it first." … … 161 120 } 162 121 163 sdtdSubcommandInstancesPrintConfig() {164 if [ $(isValidInstance "$1") -eq 0 ]; then165 echo "No instance given or not a valid instance!"166 return167 fi168 169 INSTANCE=$1170 loadCurrentConfigValues "$1"171 172 configEditAll printConfigValue173 }174 175 122 sdtdCommandInstances() { 176 123 SUBCMD=$1 … … 188 135 delete) 189 136 sdtdSubcommandInstancesDelete "$@" 190 ;;191 print_config)192 sdtdSubcommandInstancesPrintConfig "$@"193 137 ;; 194 138 *) … … 218 162 case $1 in 219 163 2) 220 echo "list create edit delete print_config"164 echo "list create edit delete" 221 165 ;; 222 166 3) 223 167 case $2 in 224 edit|delete |print_config)168 edit|delete) 225 169 echo "$(getInstanceList)" 226 170 ;;
Note:
See TracChangeset
for help on using the changeset viewer.