Browse Source

cfgfs: use rdev, adaption for new busybox fdisk

Waldemar Brodkorb 7 years ago
parent
commit
e746bc628a
3 changed files with 10 additions and 9 deletions
  1. 1 1
      package/busybox/config/util-linux/Config.in
  2. 1 1
      package/cfgfs/Makefile
  3. 8 7
      package/cfgfs/src/fwcf.sh

+ 1 - 1
package/busybox/config/util-linux/Config.in

@@ -700,7 +700,7 @@ config BUSYBOX_RDATE
 
 config BUSYBOX_RDEV
 	bool "rdev"
-	default n
+	default y
 	help
 	  Print the device node associated with the filesystem mounted at '/'.
 

+ 1 - 1
package/cfgfs/Makefile

@@ -5,7 +5,7 @@ include ${ADK_TOPDIR}/rules.mk
 
 PKG_NAME:=		cfgfs
 PKG_VERSION:=		1.0.10
-PKG_RELEASE:=		2
+PKG_RELEASE:=		3
 PKG_DESCR:=		compressed config filesystem
 PKG_SECTION:=		base/apps
 PKG_URL:=		http://openadk.org/

+ 8 - 7
package/cfgfs/src/fwcf.sh

@@ -1,7 +1,7 @@
 #!/bin/sh
-# Copyright (c) 2006, 2007
+# Copyright (c) 2006-2007
 #	Thorsten Glaser <tg@mirbsd.de>
-# Copyright (c) 2009, 2010, 2011
+# Copyright (c) 2009-2017
 #	Waldemar Brodkorb <wbx@openadk.org>
 #
 # Provided that these terms and disclaimer and all copyright notices
@@ -18,6 +18,7 @@
 # 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
@@ -42,7 +43,7 @@
 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 wd=$(pwd)
 cd /
-what='Configuration Filesystem Utility (cfgfs), Version 1.09'
+what='Configuration Filesystem Utility (cfgfs), Version 1.10'
 
 who=$(id -u)
 if [ $who -ne 0 ]; then
@@ -123,7 +124,7 @@ if [ -x /sbin/mtd ];then
 fi
 
 # find backend device, first try to find partition with ID 88
-rootdisk=$(readlink /dev/root)
+rootdisk=$(rdev|cut -f 1 -d\ )
 # strip partitions (f.e. mmcblk0p2, sda2, ..)
 rootdisk=${rootdisk%p*}
 # do not cut 1-9 from mmcblk device names
@@ -131,13 +132,13 @@ echo $rootdisk|grep mmcblk >/dev/null 2>&1
 if [ $? -ne 0 ]; then
   rootdisk=${rootdisk%[1-9]}
 fi
-part=$(fdisk -l /dev/$rootdisk 2>/dev/null|awk '$5 == 88 { print $1 }')
-if [ -f .cfgfs ];then
+part=$(fdisk -l $rootdisk 2>/dev/null|awk '$8 == 88 { print $1 }')
+if [ -f .cfgfs ]; then
   . /.cfgfs
 fi
 if [ -z $part ]; then
 	# fallback to /dev/sda in case of encrypted root
-	part=$(fdisk -l /dev/sda 2>/dev/null|awk '$5 == 88 { print $1 }')
+	part=$(fdisk -l /dev/sda 2>/dev/null|awk '$8 == 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