File: postinst

package info (click to toggle)
vmelilo-installer 1.15
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 452 kB
  • sloc: sh: 89; makefile: 18
file content (126 lines) | stat: -rw-r--r-- 2,421 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/sh
set -e

. /usr/share/debconf/confmodule

log() {
    logger -t vmelilo-installer "$@"
}

error() {
    log "error: $@"
}

info() {
    log "info: $@"
}

debug() {
    log "debug: $@"
}

die() {
    template="$1"
    shift

    error "$@"
    db_input critical "$template" || [ $? -eq 30 ]
    db_go
    db_progress STOP
    exit 1
}

findfs () {
    df -h "/target$1" | sed '1d;s/[[:space:]].*//'
}

write_conf () {

    case $BOOTDEV in
        /dev/scsi*)
	  BOOTDEV=$(mapdevfs $BOOTDEV)
	  ROOTDEV=$(mapdevfs $ROOTDEV)
	;;
    esac
    cat > /target/etc/vmelilo.conf << EOF || die vmelilo-installer/conferr "Error writing /target/etc/vmelilo.conf"

## vmelilo.conf generated by debian-installer
##
## "man vmelilo.conf" for details. 
## see also /usr/share/doc/vmelilo/examples for example configurations.

default   = Linux
boot      = $BOOTDEV
delay     = 2

[boot]
label     = Linux
image     = /vmlinuz
root      = $ROOTDEV
read-only
EOF
    sed -i -e 's/do_bootloader[ ]*=[ ]*no/do_bootloader = yes/' /target/etc/kernel-img.conf
}

write_bootblock () {

    case $ARCH in
	m68k/bvme6000)
            vmearch=bvme
            ;;
	m68k/mvme16x|m68k/mvme147)
            vmearch=mvme
            ;;
    esac
    
    mount -t proc proc /target/proc
    log-output -t vmelilo-installer chroot /target /sbin/vmelilo -f || die vmelilo-installer/booterr "Error writing vmelilo"
    umount /target/proc
}


# Install vmelilo in /target 

db_progress START 0 4 vmelilo-installer/progress

ARCH="$(archdetect)"
info "architecture: $ARCH"

db_progress INFO vmelilo-installer/apt-install

if ! apt-install vmelilo; then
    info "Calling 'apt-install vmelilo' failed"
    db_input critical vmelilo-installer/apt-install-failed || [ $? -eq 30 ]
    if ! db_go; then
	db_progress STOP
	exit 10 # back up to menu
    fi
    db_get vmelilo-installer/apt-install-failed
    if [ "$RET" != true ]; then
	db_progress STOP
	exit 1
    fi
fi

db_progress STEP 1
db_progress INFO vmelilo-installer/root

ROOTDEV="$(findfs /)"
[ "$ROOTDEV" ] || die vmelilo-installer/noroot 'No root partition found'

BOOTDEV="`echo $ROOTDEV | sed -e 's/sd\([a-z]\)[0-9]*/sd\1/g' -e 's/part[0-9]*/disc/'`"
info "root: $ROOTDEV  boot: $BOOTDEV"

db_progress STEP 1
db_progress INFO vmelilo-installer/writeconf

write_conf 

db_progress STEP 1
db_progress INFO vmelilo-installer/writeboot

write_bootblock 

db_progress STEP 1
db_progress STOP