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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
# Copyright (c) 2003 - 2006 - RZ Uni Freiburg
# Copyright (c) 2006, 2007 - OpenSLX GmbH
#
# This program/file is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your feedback to feedback@openslx.org
#
# General information about OpenSLX can be found under http://openslx.org
#
# configuration functions for SuSE 10.2 which differ from functions defined
# in general SuSE base definitions ... General changes should be done there,
# version specific changes for the 10.2 go here.
# some specific stuff to initialize
preinit () {
# fake the existence of some helper binaries/scripts (which are not of any use
# within initialramfs)
local shell="/bin/sh"
local item
if [ -x /bin/busybox ] ; then
shell="/bin/ash"
else
for item in hwup ifup ; do
echo -e "#!$shell\n:" >/sbin/${item}
done
mkdir /lib/udev /usr/sbin
for item in usb_id scsi_id vol_id edd_id ata_id path_id cdrom_id idedma.sh \
mount.sh rename_netiface firmware.sh create_floppy_devices \
trigger_firmware_loading.sh ; do
echo -e "#!$shell\n# do nothing here\n:" >/lib/udev/${item}
done
echo -e "#!$shell\n:" >/usr/sbin/alsactl
rm /etc/udev/rules.d/60-persistent-storage.rules 2>/dev/null
chmod u+x /sbin/* /lib/udev/* /usr/sbin/*
echo -e "tty:x:5:\ndisk:x:6:\nlp:x:7:\nkmem:x:9:\nuucp:x:14:\n\
dialout:x:16:\naudio:x:17:\nvideo:x:33:\nvboxusers:!:1000:" > /etc/group
echo -e "root:x:0:0:::\nasterisk:x:106:16:::" > /etc/passwd
fi
}
# udev service - auto creation of device files
udev_hotplug () {
local result=0
echo "Starting udev"
# might be used if busybox is available
#mknod /dev/console c 5 1
#mknod /dev/null c 1 3
#mknod /dev/kmsg c 1 11
if [ -x /bin/udevd ] ; then
echo "" > /proc/sys/kernel/hotplug
udevd --daemon 2>/dev/null || result=1
trigger_device_events
usleep 50
else error "$df_errudev" nonfatal
fi
return $result
}
# acpi and powersave
config_acpi () {
rllinker acpid "10" "12"
rllinker powersaved "11" "11"
}
# configure dbus (inter application communication for kde and gnome), hal
# (hardware abstraction layer - used e.g. by powersaved), resmgr and
# policykitd (resource manager/policykitd - the user gets permissions to
# devices when loggin on)
config_dreshal () {
if [ "x$start_dreshal" = "xyes" ]; then
local start="05"
local stop="18"
if [ -f /mnt/etc/${D_INITDIR}/dbus ] ; then
strinfile "messagebus:" /mnt/etc/passwd || \
echo "messagebus:x:100:101:User for D-BUS:/var/run/dbus:/bin/false" \
>> /mnt/etc/passwd
strinfile "messagebus:" /mnt/etc/group || \
echo "messagebus:!:101:" >> /mnt/etc/group
testmkd /mnt/var/run/dbus
# set permissions with userid
echo -e "\tchown messagebus:messagebus /var/run/dbus 2>/dev/null" \
>>/mnt/etc/${D_INITDIR}/boot.slx
rllinker "dbus" "$start" "$stop"
fi
if [ -f /mnt/etc/${D_INITDIR}/resmgr ] ; then
testmkd /mnt/var/run/resmgr/classes
start="0"`expr $start + 1`
stop="0"`expr $start - 1`
rllinker "resmgr" "$start" "$stop"
fi
if [ -f /mnt/etc/${D_INITDIR}/policykitd ] ; then
testmkd /mnt/var/run/polkit
start="0"`expr $start + 1`
stop="0"`expr $start - 1`
rllinker "policykitd" "$start" "$stop"
fi
if [ -f /mnt/etc/${D_INITDIR}/haldaemon ] ; then
strinfile "haldaemon:" /mnt/etc/passwd || \
echo "haldaemon:x:105:103:User for haldaemon:/var/run/hal:/bin/false" \
>> /mnt/etc/passwd
strinfile "haldaemon:" /mnt/etc/group || \
echo "haldaemon:!:103:" >> /mnt/etc/group
testmkd /mnt/var/run/hal
# set permissions with userid
echo -e "\tchown haldaemon:haldaemon /var/run/hal 2>/dev/null" \
>>/mnt/etc/${D_INITDIR}/boot.slx
start="0"`expr $start + 1`
stop="0"`expr $start - 1`
rllinker "haldaemon" "$start" "$stop"
fi
fi
}
# config nfsv4
config_nfsv4 () {
if [ "x$start_nfsv4" = "xyes" ]; then
testmkd /mnt/var/lib/nfs/rpc_pipefs
sed -e "s,NFS_SECURITY_GSS=.*,NFS_SECURITY_GSS=\"yes\"," \
-e "s,NFS4_SUPPORT=.*,NFS4_SUPPORT=\"yes\"," \
-i /mnt/etc/sysconfig/nfs
echo -e "rpc_pipefs\t/var/lib/nfs/rpc_pipefs rpc_pipefs defaults\t 0 0\n\
nfsd\t\t/proc/fs/nfsd\tnfsd\t\tdefaults\t 0 0" >>/tmp/fstab
echo -e "\t# stuff needed for nfsv4\n\tmount -t rpc_pipefs rpc_pipefs \
/var/lib/nfs/rpc_pipefs\n\tmount -t nfsd nfsd /proc/fs/nfsd" \
>>/mnt/etc/${D_INITDIR}/boot.slx
# portmap is required for any NFS
config_portmap
rllinker "idmapd" "14" "08"
rllinker "gssd" "15" "07"
fi
}
# prepare virtual machine environment (vmware, vmplayer)
config_vmware () {
rllinker "vmware-prep" "18" "02"
rllinker "vmware" "20" "02"
sed -e "s,TARGETS =,TARGETS = vmware-prep," \
/mnt/etc/${D_INITDIR}/.depend.start >> /etc/.depend.start
echo "vmware-prep: " >> /etc/.depend.start
cp /etc/.depend.start /mnt/etc/${D_INITDIR}/.depend.start
# during vmware sessions linux should not handle usb events/devices
# vmplayer and recent versions of vmware do not need this hack
if [ ! -x /mnt/usr/bin/vmplayer ] ; then
testmkd /mnt/var/X11R6/bin
echo '#!/bin/sh'> /mnt/var/X11R6/bin/vm-udev
echo -e "# Script for blocking linux from handling usb \
devices\n# during vmware sessions. If you like to remove certain modules \
add them\n# to the list below - Dirk von Suchodoletz, <dvs@OpenSLX.com>\n\
STATE=1\nps aux|grep -i vmware|grep -v \"grep\" &>/dev/null && { STATE=0; \
/sbin/rmmod usb-storage &>/tmp/null; }\n\
[ x\$ACTION = xremove ] && { [ \$STATE = 0 ] && /sbin/rmmod usb-storage \
&>/dev/null; }\nexit \$STATE" >> /mnt/var/X11R6/bin/vm-udev
chmod u+x /mnt/var/X11R6/bin/vm-udev
echo -e "# special entry to block linux from reacting to usb events during \
running\n# vmware sessions, generated by $0 during initramfs\n# Dirk von \
Suchodoletz, <dvs@OpenSLX.com>\nSUBSYSTEM==\"usb\", ACTION==\"add\", \
PROGRAM=\"/var/X11R6/bin/vm-udev\", OPTIONS=\"ignore_device\"\n\
SUBSYSTEM==\"usb\", ACTION==\"remove\", PROGRAM=\"/var/X11R6/bin/vm-udev\"" \
>> /mnt/etc/udev/rules.d/01-udev-vm.rules
fi
}
# set up keytable (function run in hwautocfg)
# kbd runlevel link is in the list of initial runlevel scripts (see
# suse/config-10.2 file)
keytable () {
# remove unneeded components from the startscript
sed -e "/wanted keytable/,/^fi$/d;/load usb drivers/,/^esac$/d" \
-i /mnt/etc/${D_INITDIR}/kbd
sed -e "s,KEYTABLE=.*,KEYTABLE=\"${KEYTABLE}\"," \
-i /mnt/etc/${D_SYSCONFDIR}/keyboard
#echo -e "\tloadkeys ${KEYTABLE} >${LOGFILE} 2>&1\n" \
# >>/mnt/etc/${D_INITDIR}/boot.slx
rllinker kbd "01" "20"
}
# consolefont and language (function run in hwautocfg)
consolefont () {
sed -e "s,RC_LANG=.*,RC_LANG=\"${LANG}\" # added in initrd," \
-i /mnt/etc/${D_SYSCONFDIR}/language
#echo -e "\tsetfont ${CONSOLE_FONT} >${LOGFILE} 2>&1\n" \
# >>/mnt/etc/${D_INITDIR}/boot.slx
}
# check the glx and tvout stuff and configure it
checkgraphix () {
# test if unionfs
case "${XMODULE}" in
radeon)
# IGP is not supported with fglrx driver (at least not in some versions)
# comment if it works properly ...
if ! strinfile " IGP" /tmp/hwsetup.info ; then
# check ${XDESC}/ hwsetup.info device string in Cards file and then
# for needed components
test -e /mnt/lib/modules/${KERNEL}/kernel/drivers/char/drm/fglrx.ko \
&& test -e /mnt/usr/lib/xorg/modules/drivers/fglrx_drv.* && {
XMODULE=fglrx
# it only works for UnionFS enabled systems or put it in preload
# but that might be not to clever :-)
ln -sf /usr/lib/xorg/libGL.so.1.2 \
/mnt/usr/lib/libGL.so.1.2 2>/dev/null || \
echo -e "/usr/lib/xorg/libGL.so.1.2\n/usr/lib/xorg/libGL.so.1\n\
/usr/lib/xorg/libGL.so" >/mnt/etc/ld.so.preload
}
# check whether to enable tvout
if [ -n "$tvout" ] && [ "$tvout" != "no" -a "$tvout" != "NO" ] ; then
[ "$tvout" = "yes" ] && tvout="PAL-B"
TVOUT='\tOption\t\t"TVFormat" "'$tvout
TVOUT=$TVOUT'"\n\tOption\t\t"DesktopSetup" "horizontal"'
fi
fi
;;
nv)
# check for needed components
test -e /mnt/lib/modules/${KERNEL}/kernel/drivers/char/drm/nvidia.ko \
&& test -e /mnt/usr/X11R6/lib/modules/drivers/nvidia_drv.* && {
gllib=$(ls /mnt/usr/X11R6/lib/libGL.so.1.0.* 2>/dev/null|sed -n "1p")
if [ -n "$gllib" ] ; then
ln -sf ${gllib#/mnt} /mnt/usr/lib/libGL.so.1 2>/dev/null
# same for GLcore lib
gllib=$(ls /mnt/usr/X11R6/lib/libGLcore.so.1.0.* 2>/dev/null|\
sed -n "1p")
ln -sf ${gllib#/mnt} /mnt/usr/lib/libGLcore.so.1.0 2>/dev/null \
|| fail=1
# load server modules (trick put the path before the official one)
testmkd /mnt/etc/X11/modules
ln -sf /usr/lib/xorg/modules/updates/extensions/libglx.so \
/mnt/etc/X11/modules/libglx.so || fail=1
ln -sf /usr/lib/xorg/modules/updates/drivers/nvidia_drv.so \
/mnt/etc/X11/modules/nvidia_drv.so || fail=1
[ -z $fail ] && XMODULE=nvidia
# ensure proper permissions for nvidia devices
echo -e "# nvidia stuff added by $0 in InitRamFS\nKERNEL==\"nvidia*|nvidiactl*\",\
GROUP=\"video\",MODE=\"0666\"" > /mnt/etc/udev/rules.d/10-nvidia-devperms.rules
fi
}
;;
esac
}
# Xorg variable settings. Lots of stuff changed from 10.1 to 10.2
displayvars () {
Files='\tModulePath\t"/etc/X11/modules"\n
\tModulePath\t"/usr/lib/xorg/modules"\n
\tFontPath\t"/usr/share/fonts/misc/:unscaled"\n
\tFontPath\t"/usr/share/fonts/75dpi/:unscaled"\n
\tFontPath\t"/usr/share/fonts/100dpi/:unscaled"'
synapticsdrv="/usr/lib/xorg/modules/input/synaptics_drv.so"
}
|