1
|
#!/bin/sh
|
2
|
|
3
|
if [ -f /var/pfSenseDEV ]; then cp /scripts/dev_bootstrap.sh /mnt/usr/local/etc/rc.d/; chmod a+rx /mnt/usr/local/etc/rc.d/dev_bootstrap.sh; fi;
|
4
|
|
5
|
# Lets cleanup from fake root environment
|
6
|
rm -rf /mnt/cloop
|
7
|
rm -rf /mnt/dist
|
8
|
rm -f /mnt/etc/rc.d/freesbie_1st
|
9
|
rm -f /mnt/usr/local/share/freesbie/files/000.freesbie_2nd.sh
|
10
|
rm -f /mnt/etc/rc.local
|
11
|
rm -f /mnt/etc/rc.conf
|
12
|
rm -f /mnt/etc/rc.conf
|
13
|
rm -f /mnt/etc/rc.firewall
|
14
|
rm -f /mnt/etc/rc.sendmail
|
15
|
rm -f /mnt/usr/sbin/cleargpt.sh
|
16
|
touch /mnt/etc/rc.conf
|
17
|
|
18
|
# Copy the current running systems config.xml to the target installation area.
|
19
|
mkdir -p /mnt/cf/conf
|
20
|
cp -r /cf/conf/* /mnt/cf/conf/
|
21
|
# touch /mnt/cf/conf/trigger_initial_wizard # disabled in univnautes
|
22
|
|
23
|
# Prevent the system from asking for these twice
|
24
|
touch /mnt/root/.part_mount
|
25
|
touch /mnt/root/.first_time
|
26
|
|
27
|
# Updating boot loader
|
28
|
echo autoboot_delay=\"3\" >> /mnt/boot/loader.conf
|
29
|
echo vm.kmem_size=\"435544320\" >> /mnt/boot/loader.conf
|
30
|
echo vm.kmem_size_max=\"535544320\" >> /mnt/boot/loader.conf
|
31
|
|
32
|
echo kern.ipc.nmbclusters=\"0\" >> /mnt/boot/loader.conf
|
33
|
|
34
|
# Hide usbus# from network interfaces list on pfSense >= 2.1
|
35
|
VERSION=`head -n 1 /mnt/etc/version | cut -c 1-3`; if [ "${VERSION}" != "1.2" -a "${VERSION}" != "2.0" ]; then echo hw.usb.no_pf=\"1\" >> /mnt/boot/loader.conf; fi;
|
36
|
|
37
|
cd /mnt && rm -rf cloop/ dist/ boot/mfsroot.gz
|
38
|
|
39
|
rm -f /mnt/etc/motd
|
40
|
|
41
|
# Set platform back to pfSense to prevent freesbie_1st from running
|
42
|
echo "pfSense" > /mnt/etc/platform
|
43
|
|
44
|
# Remove TCSHRC installer alias
|
45
|
grep -v lua_installer /root/.tcshrc > /mnt/root/.tcshrc
|
46
|
rm -rf /mnt/scripts
|
47
|
find /mnt/ -name installer -or -name lua_installer -exec rm {} \;
|
48
|
find /mnt/ -name 000.unionfs -or -name lua_installer -exec rm {} \;
|
49
|
|
50
|
# Self destruct myself.
|
51
|
rm -f /mnt/usr/local/bin/after_installation_routines.sh
|
52
|
|
53
|
# Let parent script know that a install really happened
|
54
|
touch /tmp/install_complete
|
55
|
|
56
|
chmod a-w /mnt/boot/loader.rc
|
57
|
chflags schg /mnt/boot/loader.rc
|
58
|
|
59
|
mkdir -p /mnt/var/installer_logs
|
60
|
cp /tmp/install.disklabel /mnt/var/installer_logs
|
61
|
cp /tmp/install.disklabel* /mnt/var/installer_logs
|
62
|
cp /tmp/installer.log /mnt/var/installer_logs
|
63
|
cp /tmp/install-session.sh /mnt/var/installer_logs
|
64
|
cp /tmp/new.fdisk /mnt/var/installer_logs
|
65
|
|
66
|
mkdir -p /mnt/var/db/pkg
|
67
|
cd /var/db/pkg ; tar -cpf - . | (cd /mnt/var/db/pkg ; tar -xpf -)
|
68
|
|
69
|
# If the platform is vmware, lets do some fixups.
|
70
|
if [ -f /var/IS_VMWARE ]; then echo "" >> /mnt/etc/sysctl.conf; echo "kern.timecounter.hardware=i8254" >> /mnt/etc/sysctl.conf; echo kern.hz="100" >> /mnt/boot/loader.conf; fi;
|
71
|
|
72
|
# Remove the PCBSD installer items, we do not need it once we are installed
|
73
|
if [ -d /mnt/usr/sbin/pc-sysinstall ]; then rm -rf /mnt/usr/sbin/pc-sysinstall; fi;
|
74
|
|
75
|
# Fixup permissions on installed files
|
76
|
if [ -f /etc/installed_filesystem.mtree ]; then /usr/sbin/mtree -U -e -q -f /etc/installed_filesystem.mtree -p /mnt/ > /mnt/conf/mtree.log; fi;
|
77
|
|
78
|
#Sync disks
|
79
|
/bin/sync
|