I’m looking for some help with a web-interface challenge where the number of fields for a specific parameter is dependent on an earlier specified (and saved) parameter. What I’m looking for is a variable with another variable appended.
It is the part html "$NDAS_MOUNTINSTRUCTION$i1" that is not working.
This is similar to what is asked here: http://stackoverflow.com/questions/...d-variable-names-from-other-variables-in-bash
Both suggestions ${!variable} or an array don’t seem possible with busybox shell scripts.
The applicable files:
ndas.cgi:
ndas.cfg:
Are there options available or other alternatives?
Code:
i=1
while [ $i -le $NDAS_NETDISKPARTITIONS1 ]; do
cat << EOF
<tr>
<td>Mount command partiontion nda$i:</td>
<td><input type="text" name="mountinstruction$i" size="2" maxlength="2" value="$(html "$NDAS_MOUNTINSTRUCTION$i1")"></td>
</tr>
EOF
let i++
done
It is the part html "$NDAS_MOUNTINSTRUCTION$i1" that is not working.
This is similar to what is asked here: http://stackoverflow.com/questions/...d-variable-names-from-other-variables-in-bash
Both suggestions ${!variable} or an array don’t seem possible with busybox shell scripts.
The applicable files:
ndas.cgi:
Code:
#!/bin/sh
. /usr/lib/libmodcgi.sh
check "$NDAS_ENABLED" yes:auto "*":man
check "$NDAS_READONLYREADWRITE1" r:read "*":write
check "$NDAS_SBM_NFS1" s:smb n:nfs "*":other
sec_begin 'Start type'
cat << EOF
<p>
<input id="e1" type="radio" name="enabled" value="yes"$auto_chk><label for="e1">Automatic</label>
<input id="e2" type="radio" name="enabled" value="no"$man_chk><label for="e2">Manual</label>
EOF
cat << EOF
</p>
EOF
sec_end
sec_begin 'ndas'
cat << EOF
<table border="0">
<tr>
<td>Number of Partitions:</td>
<td><input type="text" name="netdiskpartitions1" size="2" maxlength="2" value="$(html "$NDAS_NETDISKPARTITIONS1")"></td>
</tr>
<tr>
<td>Register ID:</td>
<td><input type="text" name="registerid1" size="29" maxlength="29" value="$(html "$NDAS_REGISTERID1")"></td>
</tr>
<tr>
<td>Register Key:</td>
<td><input type="text" name="registerkey1" size="5" maxlength="5" value="$(html "$NDAS_REGISTERKEY1")"></td>
</tr>
<tr>
<td>Disk Access Privilege:</td>
<td><input id="p1" type="radio" name="readonlyreadwrite1" value="r"$read_chk> <label for="p1">Read only access</label></input>
<input id="p2" type="radio" name="readonlyreadwrite1" value="w"$write_chk> <label for="p2">Read Write access</label></input></td>
</tr>
<tr>
<td>Core module enabled for interface:</td>
<td><input type="text" name="device" size="5" maxlength="5" value="$(html "$NDAS_DEVICE")"></td>
</tr>
EOF
i=1
while [ $i -le $NDAS_NETDISKPARTITIONS1 ]; do
cat << EOF
<tr>
<td>Mount command partiontion nda$i:</td>
<td><input type="text" name="mountinstruction$i" size="50" maxlength="60" value="$(html "$NDAS_MOUNTINSTRUCTION$i1")"></td>
</tr>
EOF
let i++
done
cat << EOF
<tr>
<td>Restart Following Network Service:</td>
<td><input id="u1" type="radio" name="sbm_nfs1" value="s"$smb_chk> <label for="u1">Samba</label></input>
<input id="u2" type="radio" name="sbm_nfs1" value="n"$nfs_chk> <label for="u2">NFS</label></input>
<input id="u3" type="radio" name="sbm_nfs1" value="o"$other_chk> <label for="u3">None</label></input></td>
</tr>
</table>
EOF
sec_end
ndas.cfg:
Code:
export NDAS_ENABLED='no'
export NDAS_NETDISKS='1'
export NDAS_NETDISKPARTITIONS1='1'
export NDAS_REGISTERID1=''
export NDAS_REGISTERKEY1=''
export NDAS_READONLYREADWRITE1='r'
export NDAS_DEVICE='lan'
export NDAS_SBM_NFS1='o'
export NDAS_MOUNTINSTRUCTION1=''
export NDAS_MOUNTINSTRUCTION2=''
export NDAS_MOUNTINSTRUCTION3=''
Are there options available or other alternatives?
Zuletzt bearbeitet: