Lines 105-137
Link Here
|
105 |
fi |
105 |
fi |
106 |
} |
106 |
} |
107 |
|
107 |
|
108 |
configure_localdev() { |
|
|
109 |
if boolean_is_true "$LOCALDEV" ; then |
110 |
# Make mountpoint dir |
111 |
mkdir -p /var/run/drives |
112 |
# Make this sessions secret auth cookie for ltspfs |
113 |
if [ ! -f /var/run/ltspfs_token ]; then |
114 |
mcookie > /var/run/ltspfs_token |
115 |
fi |
116 |
if [ -z "$(pgrep ltspfsd)" ]; then |
117 |
/usr/bin/ltspfsd |
118 |
fi |
119 |
# cdrom devices are handled by the cdpingerponger |
120 |
if [ -z "$(pgrep -l -f -x "/usr/sbin/cdpinger cdrom$")" ]; then |
121 |
/usr/sbin/cdpinger cdrom # default for usb cdroms |
122 |
fi |
123 |
|
124 |
# and start one for every additional cdrom device |
125 |
if [ -L /dev/cdrom?* ];then |
126 |
for CDDEV in $(ls /dev/cdrom?*); do |
127 |
if [ -z "$(pgrep -l -f -x "/usr/sbin/cdpinger ${CDDEV}$")" ]; then |
128 |
/usr/sbin/cdpinger $(basename ${CDDEV}) |
129 |
fi |
130 |
done |
131 |
fi |
132 |
fi |
133 |
} |
134 |
|
135 |
configure_swap() { |
108 |
configure_swap() { |
136 |
if boolean_is_true "$USE_LOCAL_SWAP" ; then |
109 |
if boolean_is_true "$USE_LOCAL_SWAP" ; then |
137 |
# Enable local swap partition if found on local disk |
110 |
# Enable local swap partition if found on local disk |
Lines 237-306
Link Here
|
237 |
|
210 |
|
238 |
} |
211 |
} |
239 |
|
212 |
|
240 |
load_modules() { |
|
|
241 |
for module in $(env|grep ^MODULE_|sed -e s/^MODULE_[0-9]*\=//|sed -e s/\ /*/);do |
242 |
modprobe $(echo $module|tr "*" " ") |
243 |
done |
244 |
} |
245 |
|
246 |
configure_console() { |
247 |
if [ -n "$CONSOLE_KEYMAP" ]; then |
248 |
ckbcomp -model pc105 "$CONSOLE_KEYMAP" | loadkeys |
249 |
fi |
250 |
} |
251 |
|
252 |
configure_resolver() { |
253 |
hostname=$(cat /proc/sys/kernel/hostname) |
254 |
if [ -z "$hostname" ] || [ "$hostname" = "(none)" ]; then |
255 |
# ensure a default hostname, otherwise /etc/hosts may get borked. |
256 |
hostname=ltsp |
257 |
echo $hostname > /proc/sys/kernel/hostname || true |
258 |
fi |
259 |
cat <<EOF > /etc/hosts |
260 |
127.0.0.1 localhost |
261 |
127.0.0.2 $hostname |
262 |
$SERVER server |
263 |
EOF |
264 |
if [ -f /etc/hosts.ltsp ]; then |
265 |
cat /etc/hosts.ltsp >> /etc/hosts |
266 |
fi |
267 |
|
268 |
if [ -n "$DNS_SERVER" ] || [ -n "$SEARCH_DOMAIN" ]; then |
269 |
:>/etc/resolv.conf |
270 |
if [ -n "$SEARCH_DOMAIN" ]; then |
271 |
echo "search $SEARCH_DOMAIN" >> /etc/resolv.conf |
272 |
fi |
273 |
if [ -n "$DNS_SERVER" ]; then |
274 |
for n in $DNS_SERVER; do |
275 |
echo "nameserver ${n}" >> /etc/resolv.conf |
276 |
done |
277 |
fi |
278 |
fi |
279 |
} |
280 |
|
281 |
configure_syslog() { |
282 |
if [ -z "$SYSLOG" ] || [ "$SYSLOG" = "remote" ]; then |
283 |
syslog_conf=/etc/syslog.conf |
284 |
if [ -d /etc/rsyslog.d ]; then |
285 |
syslog_conf=/etc/rsyslog.d/ltsp.conf |
286 |
touch $syslog_conf |
287 |
fi |
288 |
if [ -f "$syslog_conf" ]; then |
289 |
cat <<EOF > "$syslog_conf" |
290 |
*.* @${SYSLOG_HOST:-$SERVER} |
291 |
EOF |
292 |
fi |
293 |
fi |
294 |
} |
295 |
|
296 |
configure_fstab() { |
297 |
if [ -z "$CONFIGURE_FSTAB" ] || boolean_is_true "$CONFIGURE_FSTAB" ; then |
298 |
echo "/dev/root / rootfs defaults 0 0" > /etc/fstab |
299 |
echo "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0" >> /etc/fstab |
300 |
mount /tmp |
301 |
fi |
302 |
} |
303 |
|
304 |
configure_cron() { |
213 |
configure_cron() { |
305 |
CRON_FILE=/etc/cron.d/ltsp |
214 |
CRON_FILE=/etc/cron.d/ltsp |
306 |
if [ ! -w "/etc/cron.d" ]; then |
215 |
if [ ! -w "/etc/cron.d" ]; then |
Lines 317-372
Link Here
|
317 |
done |
226 |
done |
318 |
} |
227 |
} |
319 |
|
228 |
|
320 |
run_rcfiles() { |
|
|
321 |
for i in 01 02 03 04 05 06 07 08 09 10; do |
322 |
eval rcfile=\${RCFILE_${i}} |
323 |
[ -x "$rcfile" ] && "$rcfile" $@ |
324 |
done |
325 |
} |
326 |
|
327 |
bind_mounts () { |
328 |
# set defaults |
329 |
test -z "$tmpfs_dir" && tmpfs_dir=/var/lib/ltsp-client-setup |
330 |
mount -t tmpfs -o mode=0755 tmpfs $tmpfs_dir |
331 |
# preserve directory structure |
332 |
for d in $rw_dirs ; do |
333 |
if [ -d "$d" ]; then |
334 |
cd $tmpfs_dir |
335 |
tar --no-recursion -cpf - $(find $d -type d 2> /dev/null) 2> /dev/null | tar xpf - |
336 |
mount --bind $tmpfs_dir/$d $d |
337 |
else |
338 |
echo "WARNING: $d does not exist" |
339 |
fi |
340 |
done |
341 |
# copy contents into tmpfs |
342 |
for d in $copy_dirs $temp_copy_dirs; do |
343 |
if [ -d "$d" ]; then |
344 |
cd $tmpfs_dir |
345 |
tar -cpf - $d 2> /dev/null | tar xpf - |
346 |
mount --bind $tmpfs_dir/$d $d |
347 |
else |
348 |
echo "WARNING: $d does not exist" |
349 |
fi |
350 |
done |
351 |
# mount one file on top of another |
352 |
for f in $bindfiles ; do |
353 |
if [ -e "$f" ]; then |
354 |
mkdir -p "$(dirname $tmpfs_dir/$f)" |
355 |
cp $f $tmpfs_dir/$f |
356 |
mount --bind $tmpfs_dir/$f $f |
357 |
else |
358 |
echo "WARNING: $f does not exist" |
359 |
fi |
360 |
done |
361 |
} |
362 |
|
363 |
bind_unmounts() { |
364 |
for dir in $temp_copy_dirs; do |
365 |
umount $dir |
366 |
rm -rf $tmpfs_dir/${dir#/} |
367 |
done |
368 |
} |
369 |
|
370 |
nbd_sendsigs_protection() { |
229 |
nbd_sendsigs_protection() { |
371 |
if [ -n "$NBD_SERVER" ]; then |
230 |
if [ -n "$NBD_SERVER" ]; then |
372 |
# register pids of nbd-client and nbd-proxy so that sendsigs doesn't kill |
231 |
# register pids of nbd-client and nbd-proxy so that sendsigs doesn't kill |