/
StartLiveCD
executable file
·196 lines (169 loc) · 6.13 KB
/
StartLiveCD
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
source GoboPath
source StartFunctions
source ScriptFunctions
Import PostInstall
Import Requirements
export LANG=en_US.UTF-8
clear
######################################
# Hostname => "LiveCD"
######################################
msg "Setting hostname"
hostname LiveCD
######################################
# start the udev daemon
######################################
msg "Starting Udev"
mountpoint -q /sys || mount -t sysfs none /sys
${goboTasks}/Udev
msg "Starting log daemon"
syslogd
######################################
# load OSS compatibility for ALSA
######################################
modinfo snd-pcm-oss >& /dev/null && modprobe snd-pcm-oss
modinfo snd-mixer-oss >& /dev/null && modprobe snd-mixer-oss
######################################
# load FUSE for unionfs
######################################
modinfo fuse >& /dev/null && modprobe fuse
######################################
# launch the loopback interface
######################################
msg "Launching the loopback interface"
ifconfig lo 127.0.0.1
######################################
# mount extra partitions
######################################
for i in `fdisk -l | grep "Linux swap" | cut -d" " -f1`
do
msg "Enabling swap on $i"
swapon "$i"
done
######################################
# Mount remaining filesystems
######################################
mount -a -t usbfs
mountpoint -q /System/Kernel/Modules || mount /System/Kernel/Modules
############################################################
# Run PostInstall scripts and prepare the Environment Cache
############################################################
cat /dev/null > ${goboEnvironment}/Cache
for package in `ls ${goboPrograms}`
do
# Skip annoying packages not needed in the live environment
if [ "${package}" = "DocBook-XML-DTD" -o "${package}" = "DocBook-XSL-Stylesheets" ]
then
continue
fi
version="$(readlink ${goboPrograms}/${package}/Current)"
if [ -e ${goboPrograms}/${package}/${version}/Resources/PostInstall ]
then
chmod +x ${goboPrograms}/${package}/${version}/Resources/PostInstall
Run_PostInstall "${package}" "${version}" "" "" "/" 2>&1 >/dev/null
fi
if [ -e ${goboPrograms}/${package}/${version}/Resources/Environment ]
then
ln -nfs ${goboPrograms}/${package}/${version}/Resources/Environment ${goboEnvironment}/${package}--${version}
cat ${goboPrograms}/${package}/${version}/Resources/Environment >> ${goboEnvironment}/Cache
fi
done
source ${goboEnvironment}/Cache
######################################
# Initialize Users directory
######################################
msg "Initializing home directory"
mkdir -p ${goboUsers}
export HOME=${goboUsers}/root
if [ ! -f $HOME/.zshrc ]
then
cp -a ${goboPrograms}/EnhancedSkel/Current/Resources/Defaults/Settings/skel $HOME || mkdir -p $HOME
cp -a ${goboPrograms}/LiveCD/Current/Data/Users_gobo/.local $HOME
cp -a ${goboPrograms}/LiveCD/Current/Data/Users_gobo/.zshrc $HOME
cd $HOME
GrepReplace -R "/Users/testuser" $HOME
rm -f Desktop/Manager.desktop
cd - &> /dev/null
fi
########################################
# GoboHide task
########################################
msg "Hiding legacy directories"
StartTask GoboHide
########################################
# Message bus
########################################
msg "Starting message bus and hardware abstraction layer"
StartTask MessageBus
######################################
# Printing services
######################################
msg "Starting printing services"
StartTask CUPS
StartTask Avahi
######################################
# Change console font
######################################
msg "Setting console font"
if [ "$LANG" = "hu_HU" ]
then setfont "${goboSettings}/kbd/consolefonts/lat2-16.psfu.gz"
else setfont "${goboShared}/consolefonts/lode-2.0-lat1u-16.psfu.gz"
fi
######################################
# Launch the configuration script
######################################
ConfigureLiveCD
export LANG=`cat ${goboTemp}/setup/language`
######################################
# DHCP
######################################
# Executes the 'launch_dhcp' function if an ethernet interface was found
for interface in $(NetInterfaces)
do
if ifconfig $interface >& /dev/null
then
msg "Starting dhcp client on $interface";
launch_dhcp $interface;
fi
done
######################################
# Configure date and time
######################################
msg "Configuring date and time"
hwclock --hctosys
######################################
# Prepare grub device map file
######################################
msg "Preparing GRUB device map"
device_map="${goboBoot}/grub/device.map"
[ -e "$device_map" ] || echo quit | grub --device-map "$device_map" --batch &> /dev/null &
######################################
# Welcome message
######################################
clear
cat ${goboPrograms}/LiveCD/Current/Data/Language/Welcome_${LANG}
#################################################
# Fix the multi-user console and enable CD eject
#################################################
inittablnk=${goboPrograms}/LiveCD/Settings/inittab
rm -f ${goboSettings}/inittab
cp $inittablnk ${goboSettings}/inittab
GrepReplace -B "/System/Index/bin/BootDriver Reboot" \
"/System/Tasks/Eject start Reboot" \
${goboSettings}/inittab
#######################################################
# Fix the video driver on VMware, QEMU, and VirtualBox
#######################################################
product=$(dmidecode --string system-product-name)
chassis=$(dmidecode --string chassis-manufacturer)
intel_vga=$(lspci -nn | grep VGA | grep Intel)
if [ "$product" = "VirtualBox" ] || [ "$product" = "VMware Virtual Platform" ] || [ "$chassis" = "QEMU" ] || [ -z "$intel_vga" ]
then
rm -f /Programs/Xorg-Driver/Current/share/X11/xorg.conf.d/20-intel.conf
rm -f /Programs/Xorg-Driver/Current/lib/xorg/modules/drivers/vmware_drv.*
fi
########################################
# Fix support for Compile on the LiveCD
########################################
grep -v overlayfs /System/Settings/Scripts/Directories.conf > /tmp/x && mv /tmp/x /System/Settings/Scripts/Directories.conf