~ubuntu-installer/ubiquity/trunk

2108.1.3 by Mario Limonciello
move all scripts to scripts/ directory
1
#!/bin/sh
2
# Used to Launch MythTV-Setup & MySQL as needed
3
# Copyright © 2007  Mario Limonciello
4
5
#Let debconf work
6
. /usr/share/debconf/confmodule
2108.1.46 by Mario Limonciello
need to adjust username in multiple areas
7
db_get passwd/username
8
USER=$RET
2108.1.3 by Mario Limonciello
move all scripts to scripts/ directory
9
10
ROOT="/target"
11
chroot=chroot
12
log='log-output -t mythbuntu'
13
14
mount -t proc none $ROOT/proc
15
mount -t devpts none $ROOT/dev/pts
16
mount -t sysfs sysfs $ROOT/sys
17
mount --bind /lib/modules/`uname -r`/volatile $ROOT/lib/modules/`uname -r`/volatile
18
19
#to run X apps in the chroot
2400 by Mario Limonciello
revamp scripts/mythbuntu/mythbuntu-setup
20
NEW_HOSTNAME=$(cat $ROOT/etc/hostname)
21
xhost + local:""
22
sed -i s/ubuntu$/ubuntu\ $NEW_HOSTNAME/ /etc/hosts
2108.1.3 by Mario Limonciello
move all scripts to scripts/ directory
23
mkdir -p $ROOT/tmp/.X11-unix
24
mount --bind /tmp/.X11-unix $ROOT/tmp/.X11-unix
25
26
#Prepare chroot script
27
db_get mythbuntu/install_type
28
TYPE="$RET"
2152 by Colin Watson
POSIX test syntax
29
if [ "$TYPE" = "Master Backend/Frontend" ] || [ "$TYPE" = "Master Backend" ]; then
2108.1.3 by Mario Limonciello
move all scripts to scripts/ directory
30
    cat <<SETUP >$ROOT/tmp/mythtv_setup
31
#!/bin/bash
32
33
#Set our new hostname
2400 by Mario Limonciello
revamp scripts/mythbuntu/mythbuntu-setup
34
hostname $NEW_HOSTNAME
2108.1.3 by Mario Limonciello
move all scripts to scripts/ directory
35
36
#Startup SQL
37
/etc/init.d/mysql start
38
39
#Run Mythtv-setup
2400 by Mario Limonciello
revamp scripts/mythbuntu/mythbuntu-setup
40
xterm -e mythtv-setup.real
2108.1.3 by Mario Limonciello
move all scripts to scripts/ directory
41
42
#Fill Database
43
zenity --title "Fill Database?" --question --text "Would you like to run mythfilldatabase?"
44
DATABASE_NOT=\$?
45
if [ "\$DATABASE_NOT" = "0" ]; then
46
    xterm -title "Running mythfilldatabase" -e "unset DISPLAY && unset SESSION_MANAGER && mythfilldatabase; sleep 3"
47
fi
48
49
#Stop SQL
50
/etc/init.d/mysql stop
51
52
#Make sure warning doesn't come up on next boot
2108.1.46 by Mario Limonciello
need to adjust username in multiple areas
53
mkdir -p /home/$USER/.mythtv
54
chown 1000:1000 -R /home/$USER/.mythtv
2108.1.3 by Mario Limonciello
move all scripts to scripts/ directory
55
SETUP
56
else
57
    cat <<SETUP >$ROOT/tmp/mythtv_setup
58
#!/bin/bash
59
60
#Set our new hostname
2400 by Mario Limonciello
revamp scripts/mythbuntu/mythbuntu-setup
61
hostname $NEW_HOSTNAME
2108.1.3 by Mario Limonciello
move all scripts to scripts/ directory
62
63
#Run Mythtv-setup
2400 by Mario Limonciello
revamp scripts/mythbuntu/mythbuntu-setup
64
xterm -e mythtv-setup.real
2108.1.3 by Mario Limonciello
move all scripts to scripts/ directory
65
66
#Fill Database
67
zenity --title "Fill Database?" --question --text "Would you like to run mythfilldatabase?"
68
DATABASE_NOT=\$?
69
if [ "\$DATABASE_NOT" = "0" ]; then
70
    xterm -title "Running mythfilldatabase" -e "unset DISPLAY && unset SESSION_MANAGER && mythfilldatabase; sleep 3"
71
fi
72
73
#Make sure warning doesn't come up on next boot
2108.1.45 by Mario Limonciello
fix hdhomerun config and backend_configured behavior
74
mkdir -p /home/$USER/.mythtv
75
chown 1000:1000 -R /home/$USER/.mythtv
2108.1.3 by Mario Limonciello
move all scripts to scripts/ directory
76
SETUP
77
fi
78
79
#Launch chroot script
80
chmod +x $ROOT/tmp/mythtv_setup
81
$log $chroot $ROOT /tmp/mythtv_setup
82
rm $ROOT/tmp/mythtv_setup
83
84
#to clean up the whole procedure
85
umount $ROOT/proc
86
umount $ROOT/sys
87
umount $ROOT/dev/pts
88
umount $ROOT/tmp/.X11-unix
89
umount $ROOT/lib/modules/`uname -r`/volatile