File: rec-initdefault.rb

package info (click to toggle)
augeas 0.2.2-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,080 kB
  • ctags: 3,084
  • sloc: ansic: 22,252; sh: 10,348; yacc: 435; ruby: 410; lex: 172; makefile: 126
file content (32 lines) | stat: -rw-r--r-- 803 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Change the initdefault
#
# Note that we would really like to query for the node whose 'action' is
# initdefault and then set its 'runlevels' sibling. That's not possible,
# mostly because the testing framework and augtool are too simplistic to do
# that. Would be easy with a shell script

# Query for the record that holds the initdefault
record=""
`augtool -n match '/files/etc/inittab/*/action' initdefault`.each do |l|
    if l =~ %r{^(/files/etc/inittab/[0-9]+)}
        record = $1
    end
end
commands="
set #{record}/runlevels 3
save
"

diff["/etc/inittab"] = <<TXT
--- /etc/inittab
+++ /etc/inittab.augnew
@@ -15,7 +15,7 @@
 #   5 - X11
 #   6 - reboot (Do NOT set initdefault to this)
 #
-id:5:initdefault:
+id:3:initdefault:

 # System initialization.
 si::sysinit:/etc/rc.d/rc.sysinit
TXT