summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjonas <jonas@8f53b18a-e215-0410-8885-9f593d34873e>2006-06-10 20:47:10 +0000
committerjonas <jonas@8f53b18a-e215-0410-8885-9f593d34873e>2006-06-10 20:47:10 +0000
commit257aad2c40c2334044c2af7f39b78c554b387281 (patch)
tree1f83d46cb470cd3dfeab485e66d8430e3ceee00e
parentfdeb27487c4c2d462093438a752ab4f3fcd9ebb5 (diff)
Add new function preserveandhashdisablelines() and use it to disable /dev in flashybrid ramstore.
git-svn-id: svn+ssh://xayide/home/jonas/private_svn/fleshybrid/trunk@10 8f53b18a-e215-0410-8885-9f593d34873e
-rwxr-xr-x1_makerootfs.sh3
-rw-r--r--functions24
2 files changed, 27 insertions, 0 deletions
diff --git a/1_makerootfs.sh b/1_makerootfs.sh
index bd32573..02f5e0a 100755
--- a/1_makerootfs.sh
+++ b/1_makerootfs.sh
@@ -124,6 +124,9 @@ if [ "$FLASHYBRID" = "yes" ]; then
preserveandaddlines "$targettemp/etc/flashybrid/ramtmp" orig 1 $flashybrid_ramtmp
preserveandaddlines "$targettemp/etc/flashybrid/ramstore" orig 1 $flashybrid_ramstore
preserveandaddlines "$targettemp/etc/flashybrid/diskstore" orig 1 $flashybrid_diskstore
+ # Disable /dev
+ # FIXME: Add and honour flag about using udev or not
+ preserveandhashdisablelines "$targettemp/etc/flashybrid/ramstore" orig 1 "/dev"
# Move off flashybrid directories (but leave empty dir behind)
mkdir -p "$targetoffline" "$targettemp/ram" "$targettemp/disk"
preserveandaddlines "$targettemp/etc/fstab" orig 2 "$diskdev_target\t/disk\t$diskfs\tdefaults,noauto,nolock\t0\t0"
diff --git a/functions b/functions
index a943255..2a7cfa3 100644
--- a/functions
+++ b/functions
@@ -87,6 +87,30 @@ function preserveandaddlines() {
return 0
}
+function preserveandhashdisablelines() {
+ ## DESC: Backup older file and disable lines in it
+ # File to tweak
+ file="$1"; shift
+ # Extension of backup file
+ ext="$1"; shift
+ # Word number in line to search for and replace if found
+ wordno="$1"; shift
+ preserveolderfile "$file" "$ext"
+# disablelines "$file" "$wordno" "#" $@
+ # FIXME: Somehow avoid expansion, to make possibe a separate disablelines()
+ [ -e "$file" ] || touch "$file"
+ for line; do
+ [ -z "$line" ] && continue
+ firstword=$(echo "$line" | awk "{print \$$wordno}")
+ # FIXME: Why doesn't it work to print ARGVOUT in END block?
+ linemissing=$(perl -i -pe "END { print \"$line\\n\" unless \$seen } s¡^(\s*$firstword)\s.*¡#$line\\n¡ and \$seen++" "$file")
+#"This stray quote is only to please buggy mc (cooledit) code hiliting
+ [ -n "$linemissing" ] && echo >2 "Line \"$linemissing\" not found to disable in $file"
+ done
+ # FIXME: Figure out what exits non-zero above
+ return 0
+}
+
function perlrelines() {
## DESC: Apply perl regex to lines of a single file
# File to tweak