- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/commands/instances.sh
r20 r24 1 1 #!/bin/bash 2 # Version 53 2 4 3 … … 52 51 esac 53 52 done 54 fi 55 configEditAll 53 echo 54 fi 55 configEditAll configQueryValue 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 configEditAll 82 echo 83 configSetAutoParameters "$INSTANCE" 84 echo 85 echo "Saving" 86 saveCurrentConfigValues "$1" 87 echo "Done" 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 88 129 else 89 130 echo "Instance $1 is currently running. Please stop it first." … … 120 161 } 121 162 163 sdtdSubcommandInstancesPrintConfig() { 164 if [ $(isValidInstance "$1") -eq 0 ]; then 165 echo "No instance given or not a valid instance!" 166 return 167 fi 168 169 INSTANCE=$1 170 loadCurrentConfigValues "$1" 171 172 configEditAll printConfigValue 173 } 174 122 175 sdtdCommandInstances() { 123 176 SUBCMD=$1 … … 136 189 sdtdSubcommandInstancesDelete "$@" 137 190 ;; 191 print_config) 192 sdtdSubcommandInstancesPrintConfig "$@" 193 ;; 138 194 *) 139 195 sdtdCommandInstancesHelp … … 162 218 case $1 in 163 219 2) 164 echo "list create edit delete "220 echo "list create edit delete print_config" 165 221 ;; 166 222 3) 167 223 case $2 in 168 edit|delete )224 edit|delete|print_config) 169 225 echo "$(getInstanceList)" 170 226 ;;
Note:
See TracChangeset
for help on using the changeset viewer.