rendered paste bodyIndex: root/etc/init.d/rc.swap
===================================================================
--- root/etc/init.d/rc.swap (revision 1567)
+++ root/etc/init.d/rc.swap (working copy)
@@ -22,18 +22,41 @@
return 1
}
+swapon_file () {
+i=0
+while [ $i -le 20 ]; do
+ if [ -e $MOD_SWAP_FILE ]; then
+ swapon $MOD_SWAP_FILE
+ break
+ fi
+ i=`expr $i + 1` && sleep 2
+done
+}
+
+swapon_device () {
+i=0
+while [ $i -le 20 ]; do
+ if grep -q "$MOD_SWAPFILE" /proc/partitions; then
+ swapon $MOD_SWAP_FILE
+ break
+ fi
+ i=`expr $i + 1` && sleep 2
+done
+}
+
start () {
echo -n "Starting $DAEMON..."
- i=0
- while [ $i -le 20 ]; do
- if [ -e $MOD_SWAP_FILE ]; then
- swapon $MOD_SWAP_FILE
- break
- fi
- i=`expr $i + 1` && sleep 2
- done
-
+
+ [ "${MOD_SWAP_FILE##/dev/*}" ]
+
+ if [ "$?" -eq 0 ]; then
+ swapon_file
+ else
+ swapon_device
+ fi
+
sleep 1
+
has_swap
if [ "$?" -eq 0 ]; then
echo 'done.'
@@ -45,7 +68,7 @@
stop () {
echo -n "Stopping $DAEMON... "
- swapoff $MOD_SWAPFILE
+ swapoff $MOD_SWAPFILE
sleep 1
has_swap
if [ "$?" -ne 0 ]; then
@@ -57,7 +80,7 @@
}
case "$1" in
- ""|load)
+ ""|load)
if [ "$MOD_SWAP" != "yes" ]; then
echo "$DAEMON is disabled" 1>&2
exit 1;
Index: root/usr/mww/cgi-bin/settings.cgi
===================================================================
--- root/usr/mww/cgi-bin/settings.cgi (revision 1567)
+++ root/usr/mww/cgi-bin/settings.cgi (working copy)
@@ -39,8 +39,8 @@
<input id="s1" type="radio" name="swap" value="yes"$swap_auto_chk><label for="s1"> $(lang de:"Automatisch" en:"Automatic")</label>
<input id="s2" type="radio" name="swap" value="no"$swap_man_chk><label for="s2"> $(lang de:"Manuell" en:"Manual")</label>
</p>
-<h2>Swapfile ($(lang de:"Beispiel:" en:"e.g.") /var/media/ftp/uStor01/swapfile)</h2>
-<p>Swapfile: <input type="text" name="swap_file" size="50" maxlength="50" value="$(httpd -e "$MOD_SWAP_FILE")"></p>
+<h2>Swap ($(lang de:"Beispiel:" en:"e.g.") /var/media/ftp/uStor01/swapfile $(lang de:"oder" en:"or")) /dev/sda1</h2>
+<p>Swap: <input type="text" name="swap_file" size="50" maxlength="50" value="$(httpd -e "$MOD_SWAP_FILE")"></p>
EOF
sec_end