summaryrefslogtreecommitdiff
path: root/distrib/zaurus/ipk/postinst
blob: 3e50f36415ea7bd91f58ac05998d31da6ba999aa (plain)
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
#!/bin/sh
#	$OpenBSD: postinst,v 1.4 2005/07/12 06:33:41 uwe Exp $
#
# Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

cd /root/etc/rc.d || exit $?

rmmod zbsdmod 2>/dev/null

mount -o remount,rw /

if [ ! -f rc.rofilesys.openbsd ]; then
	cp -p rc.rofilesys rc.rofilesys.openbsd
fi

cat rc.rofilesys | sed -e '/vfat/s/^/#/' > tmp || exit $?
mv tmp rc.rofilesys
cat rc.rofilesys | sed -e '/^LINUXFMT=ext3$/s/^/#/' \
    -e '/^#LINUXFMT=ext2$/s/^#//' > tmp || exit $?
mv tmp rc.rofilesys
cat rc.rofilesys | sed \
    -e '/\/pcmcia start$/s,$,; sh /root/etc/rc.d/rc.zboot,' > tmp || exit $?
mv tmp rc.rofilesys
chown root:root rc.rofilesys
chmod 775 rc.rofilesys

# Convert all mounted ext3 filesystems back into ext2 on reboot.
for dev in `mount | awk '/on \/hdd[123] type ext3/ {print $1}'`; do
	cat <<- EOF | debugfs
	open -f -w ${dev}
	features -has_journal -needs_recovery
	quit
EOF
done

rm -f rc.zboot
rm -f zboot
rm -f zbsdmod.o
cp /usr/local/OpenBSD/rc.zboot .
cp /usr/local/OpenBSD/zboot .
cp /usr/local/OpenBSD/zbsdmod.o .

sync; sleep 3
mount -o remount,ro /

insmod /usr/local/OpenBSD/zbsdmod.o