summaryrefslogtreecommitdiff
path: root/package/cfgfs/src/fwcf.sh
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2009-06-04 19:49:34 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2009-06-04 19:49:34 +0200
commit8a2754e0fbdea7497281327f2896be2a1253a107 (patch)
treebc7c400745fde54e6fb7a010fcb026258564d3bc /package/cfgfs/src/fwcf.sh
parent9bd4456c5a83c3474fdf9fe5cf14004a0874e2c8 (diff)
parent2d3aaf1664850031f5497e121dc82ab65f63641a (diff)
Merge branch 'master' of ssh://openadk.org/git/openadk
Diffstat (limited to 'package/cfgfs/src/fwcf.sh')
-rw-r--r--package/cfgfs/src/fwcf.sh20
1 files changed, 12 insertions, 8 deletions
diff --git a/package/cfgfs/src/fwcf.sh b/package/cfgfs/src/fwcf.sh
index ad75ee79e..890dcf216 100644
--- a/package/cfgfs/src/fwcf.sh
+++ b/package/cfgfs/src/fwcf.sh
@@ -1,9 +1,8 @@
#!/bin/sh
-#-
# Copyright (c) 2006, 2007
# Thorsten Glaser <tg@mirbsd.de>
# Copyright (c) 2009
-# Waldemar Brodkorb <openadk@waldemar-brodkorb.de>
+# Waldemar Brodkorb <wbx@openadk.org>
#
# Provided that these terms and disclaimer and all copyright notices
# are retained or reproduced in an accompanying document, permission
@@ -19,7 +18,6 @@
# of dealing in the work, even if advised of the possibility of such
# damage or existence of a defect, except proven that it results out
# of said person's immediate fault when using the work as intended.
-#-
# Possible return values:
# 0 - everything ok
# 1 - syntax error
@@ -44,7 +42,13 @@
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
wd=$(pwd)
cd /
-what='Configuration Filesystem (cfgfs), Version 1.06'
+what='Configuration Filesystem Utility (cfgfs), Version 1.06'
+
+who=$(id -u)
+if [ $who -ne 0 ]; then
+ echo 'Exit. Configuration Filesystem Utility must be run as root.'
+ exit 1
+fi
usage() {
cat >&2 <<EOF
@@ -109,10 +113,10 @@ EOF
exit 1 ;;
esac
-uname=$(uname -m)
-if [[ "$uname" = "i586" ]];then
- part=/dev/sda2
-else
+# find backend device, first try to find partition with ID 88
+part=$(fdisk -l|awk '$5 == 88 { print $1 }')
+if [ -z $part ]; then
+ # otherwise search for MTD device with name cfgfs
part=/dev/mtd$(fgrep '"cfgfs"' /proc/mtd 2>/dev/null | sed 's/^mtd\([^:]*\):.*$/\1/')ro
fi