51 |
# setup needed directories |
# setup needed directories |
52 |
[ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state |
[ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state |
53 |
|
|
|
|
|
|
# read_cmdline ${item} |
|
|
read_cmdline() |
|
|
{ |
|
|
local i |
|
|
|
|
|
for i in $(< /proc/cmdline) |
|
|
do |
|
|
[[ ${i} = $1 ]] && return 0 |
|
|
done |
|
|
|
|
|
return 1 |
|
|
} |
|
|
|
|
54 |
update_system_settings() |
update_system_settings() |
55 |
{ |
{ |
56 |
echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} |
rc_mecho Checking system setup ... |
57 |
|
|
58 |
# get the modules settings |
# get the modules settings |
59 |
# ! is the first thing that must be configured ! |
# ! is the first thing that must be configured ! |
112 |
CUR_MAC=$(ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11) |
CUR_MAC=$(ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11) |
113 |
CUR_MTIME=$(date +%s) |
CUR_MTIME=$(date +%s) |
114 |
|
|
115 |
echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
rc_print "Trying to validate my serial ..." |
116 |
|
|
117 |
# nice serial output |
# nice serial output |
118 |
$CURS_UP |
$CURS_UP |
135 |
echo |
echo |
136 |
if [[ ${ALX_FORCED_RECHECK} = true ]] |
if [[ ${ALX_FORCED_RECHECK} = true ]] |
137 |
then |
then |
138 |
echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT} |
rc_mecho "Hardware autodetection forced by system-administrator" |
139 |
# always disable CONFD_NETWORKING here |
# always disable CONFD_NETWORKING here |
140 |
export ALX_CONFD_NETWORKING="false" |
export ALX_CONFD_NETWORKING="false" |
141 |
else |
else |
142 |
echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT} |
rc_mecho "Preparing system for first boot" |
143 |
fi |
fi |
144 |
ALX_HW_DETECT=true |
ALX_HW_DETECT=true |
145 |
hwsetup |
hwsetup |
175 |
# but first check the serial |
# but first check the serial |
176 |
source /etc/alxconfig-ng/serial |
source /etc/alxconfig-ng/serial |
177 |
|
|
178 |
echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
rc_print "Trying to validate my serial ..." |
179 |
|
|
180 |
# nice serial output |
# nice serial output |
181 |
$CURS_UP |
$CURS_UP |
203 |
return 0 |
return 0 |
204 |
fi |
fi |
205 |
|
|
206 |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
rc_print "Trying to get new serial ..." |
207 |
|
|
208 |
# request a new serial; one command now (cause must be done in the same session) |
# request a new serial; one command now (cause must be done in the same session) |
209 |
ALX_SERIAL=$(mysqldo "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}'); |
ALX_SERIAL=$(mysqldo "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}'); |
275 |
source /etc/conf.d/hwsetup/mouse |
source /etc/conf.d/hwsetup/mouse |
276 |
|
|
277 |
echo |
echo |
278 |
echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT} |
rc_mecho "Importing detected settings to database" |
279 |
|
|
280 |
# network |
# network |
281 |
echo -e " Network settings ..." |
rc_mecho " Network settings ..." |
282 |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
283 |
then |
then |
284 |
# get settings |
# get settings |
|
#source ${rc_base}/init.d/network &> /dev/null |
|
285 |
for iface in $(onboot_interface_list ${network_settings}/net.*) |
for iface in $(onboot_interface_list ${network_settings}/net.*) |
286 |
do |
do |
287 |
[[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue |
[[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue |
288 |
echo "WARNING: only importing settings for interface [ ${iface} ] !" |
rc_echo "WARNING: only importing settings for interface [ ${iface} ] !" |
289 |
source ${network_settings}/net.${iface} || exit 1 |
source ${network_settings}/net.${iface} || echo "Error: could not read '${network_settings}/net.${iface}'" |
290 |
NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)" |
NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)" |
291 |
|
|
292 |
mysqldo "insert into cfg_network( |
mysqldo "insert into cfg_network( |
358 |
evaluate_retval |
evaluate_retval |
359 |
|
|
360 |
# xserver |
# xserver |
361 |
echo -e " Graphic settings ..." |
rc_mecho " Graphic settings ..." |
362 |
# xserver general |
# xserver general |
363 |
( mysqldo "insert into cfg_graphic( |
( mysqldo "insert into cfg_graphic( |
364 |
serial, |
serial, |
377 |
evaluate_retval |
evaluate_retval |
378 |
|
|
379 |
# input |
# input |
380 |
echo -e " Input settings ..." |
rc_mecho " Input settings ..." |
381 |
mysqldo "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');" |
mysqldo "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');" |
382 |
evaluate_retval |
evaluate_retval |
383 |
|
|
384 |
# auth |
# auth |
385 |
echo -e " Authentification settings ..." |
rc_mecho " Authentification settings ..." |
386 |
mysqldo "insert into client_auth( |
mysqldo "insert into client_auth( |
387 |
serial, |
serial, |
388 |
username, |
username, |
403 |
|
|
404 |
# exchange ssh rsa keys - the first boot needs this ! |
# exchange ssh rsa keys - the first boot needs this ! |
405 |
# or no reboot will work via the webadmin |
# or no reboot will work via the webadmin |
406 |
echo -e " SSH authentification settings ..." |
rc_mecho " SSH authentification settings ..." |
407 |
HOME=/root config_ssh_auth |
HOME=/root config_ssh_auth |
408 |
evaluate_retval |
evaluate_retval |
409 |
|
|
410 |
# autostart |
# autostart |
411 |
echo -e " Autostart settings ..." |
rc_mecho " Autostart settings ..." |
412 |
mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" |
mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" |
413 |
|
|
414 |
# screensaver |
# screensaver |
415 |
echo -e " Screensaver settings ..." |
rc_mecho " Screensaver settings ..." |
416 |
mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')" |
mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')" |
417 |
|
|
418 |
# version info |
# version info |
419 |
|
rc_mecho " OS version info ..." |
420 |
local alx_os |
local alx_os |
421 |
local alx_utils |
local alx_utils |
422 |
alx_os="$(< /etc/mageversion)" |
alx_os="$(< /etc/mageversion)" |
448 |
source /etc/conf.d/hwsetup/mouse |
source /etc/conf.d/hwsetup/mouse |
449 |
|
|
450 |
echo |
echo |
451 |
echo -e ${COLMAGENTA}"Updating detected settings in database"${COLDEFAULT} |
rc_mecho "Updating detected settings in database" |
452 |
|
|
453 |
# network |
# network |
454 |
echo -e " Network settings ..." |
rc_mecho " Network settings ..." |
455 |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
456 |
then |
then |
457 |
# get settings |
# get settings |
459 |
for iface in $(onboot_interface_list ${network_settings}/net.*) |
for iface in $(onboot_interface_list ${network_settings}/net.*) |
460 |
do |
do |
461 |
[[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue |
[[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue |
462 |
echo "WARNING: only importing settings for interface [ ${iface} ] !" |
rc_echo "WARNING: only importing settings for interface [ ${iface} ] !" |
463 |
source ${network_settings}/net.${iface} || exit 1 |
source ${network_settings}/net.${iface} || exit 1 |
464 |
NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)" |
NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)" |
465 |
|
|
500 |
evaluate_retval |
evaluate_retval |
501 |
|
|
502 |
# xserver |
# xserver |
503 |
echo -e " Graphic settings ..." |
rc_mecho " Graphic settings ..." |
504 |
# xserver general |
# xserver general |
505 |
mysqldo "update cfg_graphic set |
mysqldo "update cfg_graphic set |
506 |
module='${XMODULE}', |
module='${XMODULE}', |
511 |
evaluate_retval |
evaluate_retval |
512 |
|
|
513 |
# input |
# input |
514 |
echo -e " Input settings ..." |
rc_mecho " Input settings ..." |
515 |
mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};" |
mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};" |
516 |
evaluate_retval |
evaluate_retval |
517 |
|
|
518 |
# version info |
# version info |
519 |
|
rc_mecho " OS version info ..." |
520 |
local alx_os |
local alx_os |
521 |
local alx_utils |
local alx_utils |
522 |
alx_os="$(< /etc/mageversion)" |
alx_os="$(< /etc/mageversion)" |
545 |
source /etc/conf.d/hwsetup/knoppix |
source /etc/conf.d/hwsetup/knoppix |
546 |
|
|
547 |
echo |
echo |
548 |
echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT} |
rc_mecho "Importing detected settings to local system" |
549 |
|
|
550 |
if [[ ${ALX_CONFD_NETWORKING} = false ]] |
if [[ ${ALX_CONFD_NETWORKING} = false ]] |
551 |
then |
then |
554 |
echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modprobe.d/net.eth0.conf |
echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modprobe.d/net.eth0.conf |
555 |
|
|
556 |
# regenerate modprobe.conf |
# regenerate modprobe.conf |
557 |
[ -x $(which modules-update) ] && modules-update || echo "cannot regen modprobe.conf" |
[ -x $(which modules-update) ] && modules-update || rc_echo "modules-update not found!" |
558 |
evaluate_retval |
evaluate_retval |
559 |
fi |
fi |
560 |
|
|
595 |
# add a newline (maybe there is no crlf in the footer) |
# add a newline (maybe there is no crlf in the footer) |
596 |
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
597 |
|
|
|
|
|
598 |
# setup some standart icons (sysinfo.lnk) |
# setup some standart icons (sysinfo.lnk) |
|
# basic config |
|
|
cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc |
|
|
|
|
599 |
# clean desktop icon location |
# clean desktop icon location |
600 |
[ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop |
[ -d ${ALX_UNPRIV_HOME}/.idesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.idesktop |
601 |
install -d ${ALX_UNPRIV_HOME}/.xtdesktop |
install -d ${ALX_UNPRIV_HOME}/.idesktop |
602 |
|
|
603 |
# last but not least gen a icon with some sys informations |
# last but not least gen a icon with some sys informations |
604 |
local sysinfo |
local sysinfo |
620 |
--name "${sysinfo}" \ |
--name "${sysinfo}" \ |
621 |
--command "exit 0" \ |
--command "exit 0" \ |
622 |
--icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ |
--icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ |
623 |
--dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \ |
--dest "${ALX_UNPRIV_HOME}/.idesktop/sysinfo.lnk" \ |
624 |
--xres "${xres}" \ |
--xres "${xres}" \ |
625 |
--yres "${yres}" \ |
--yres "${yres}" \ |
626 |
--icon-width "1" \ |
--icon-width "1" \ |
627 |
--icon-height "1" |
--icon-height "1" |
628 |
|
|
|
# create a xinitrc |
|
|
echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc |
|
|
|
|
629 |
# set correct permissions |
# set correct permissions |
630 |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
631 |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
632 |
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
633 |
chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop |
chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop |
634 |
chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc |
chmod 0644 ${ALX_UNPRIV_HOME}/.ideskrc |
|
chmod 0644 ${ALX_UNPRIV_HOME}/.xinitrc |
|
635 |
} |
} |
636 |
|
|
637 |
# start|stop |
# start|stop |
664 |
# keeping like always safe: |
# keeping like always safe: |
665 |
# no network should be startet here, |
# no network should be startet here, |
666 |
# so we can delete all pid files if one exists |
# so we can delete all pid files if one exists |
667 |
if [[ ! -z $(pidof udhcpc) ]] |
if [[ ! -z $(pidof $(basename ${ALX_DHCP_PROG})) ]] |
668 |
then |
then |
669 |
echo -e ${COLMAGENTA}"Forcing network down"${COLDEFAULT} |
rc_mecho "Forcing network down" |
670 |
killall udhcpc &> /dev/null |
killall $(basename ${ALX_DHCP_PROG}) &> /dev/null |
671 |
sleep 1 |
sleep 1 |
672 |
fi |
fi |
673 |
[[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop |
[[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop |
674 |
|
|
675 |
echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT} |
rc_mecho "Starting preliminary networking ... " |
676 |
|
|
677 |
# start network configured from /etc/conf.d |
# start network configured from /etc/conf.d |
678 |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
679 |
then |
then |
680 |
${rc_base}/init.d/network start |
${rc_base}/init.d/network start |
681 |
else |
else |
682 |
echo -e ${COLOREDSTAR}"Starting default dhcp based networking ... "${COLDEFAULT} |
rc_print "Starting default dhcp based networking ... " |
683 |
# -t 10 timeout of 10 secs |
${ALX_DHCP_PROG} ${ALX_DHCP_START} &> /dev/null |
|
udhcpc -t 10 &> /dev/null |
|
684 |
evaluate_retval |
evaluate_retval |
685 |
fi |
fi |
686 |
;; |
;; |
687 |
|
|
688 |
stop) |
stop) |
689 |
echo -e ${COLMAGENTA}"Stopping preliminary networking ... "${COLDEFAULT} |
rc_mecho "Stopping preliminary networking ... " |
690 |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
691 |
then |
then |
692 |
${rc_base}/init.d/network stop |
${rc_base}/init.d/network stop |
693 |
else |
else |
694 |
echo -e ${COLOREDSTAR}"Stopping default dhcp based networking ... "${COLDEFAULT} |
rc_print "Stopping default dhcp based networking ... " |
695 |
ifconfig eth0 down |
ifconfig ${ALX_IFACE} down |
696 |
fi |
fi |
697 |
if [[ ! -z $(pidof udhcpc) ]] |
if [[ ! -z $(pidof $(basename ${ALX_DHCP_PROG})) ]] |
698 |
then |
then |
699 |
killall udhcpc &> /dev/null |
killall $(basename ${ALX_DHCP_PROG}) &> /dev/null |
700 |
sleep 1 |
sleep 1 |
701 |
fi |
fi |
702 |
evaluate_retval |
evaluate_retval |
712 |
{ |
{ |
713 |
# force load of de kbdkeys |
# force load of de kbdkeys |
714 |
loadkeys -q de |
loadkeys -q de |
715 |
echo |
rc_echo |
716 |
echo -en ${COLRED} |
rc_echo -en ${COLRED} |
717 |
echo -n "*** Warning: you are about to reset *all* local settings on this system!" |
rc_echo -n "*** Warning: you are about to reset *all* local settings on this system!" |
718 |
echo -e ${COLDEFAULT} |
rc_echo -e ${COLDEFAULT} |
719 |
echo "*** Do you really want to continue ?" |
rc_echo "*** Do you really want to continue ?" |
720 |
echo -n "*** Enter 'yes' to continue, anything else to abort: " |
rc_echo -n "*** Enter 'yes' to continue, anything else to abort: " |
721 |
read kbinsert |
read kbinsert |
722 |
if [[ ${kbinsert} = yes ]] |
if [[ ${kbinsert} = yes ]] |
723 |
then |
then |
724 |
echo -en ${COLRED} |
rc_echo -en ${COLRED} |
725 |
echo -n "*** OK, you really want it ... killing all settings: " |
rc_echo -n "*** OK, you really want it ... killing all settings: " |
726 |
for i in 3 2 1 now |
for i in 3 2 1 now |
727 |
do |
do |
728 |
echo -n " ${i}" |
rc_echo -n " ${i}" |
729 |
sleep 1 |
sleep 1 |
730 |
done |
done |
731 |
echo -e ${COLDEFAULT} |
rc_echo -e ${COLDEFAULT} |
732 |
|
|
733 |
## reset all settings: |
## reset all settings: |
734 |
rm -rf ${SETTINGSPATH}/* |
rm -rf ${SETTINGSPATH}/* |
754 |
# restore default networking |
# restore default networking |
755 |
cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0 |
cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0 |
756 |
|
|
757 |
echo "I am done now, press [Enter] to reboot system ..." |
rc_echo "I am done now, press [Enter] to reboot system ..." |
758 |
else |
else |
759 |
echo "Aborted, press [Enter] to reboot system ..." |
rc_echo "Aborted, press [Enter] to reboot system ..." |
760 |
fi |
fi |
761 |
read |
read |
762 |
reboot |
reboot |
889 |
echo "Usage: $0 {start|stop} ..." |
echo "Usage: $0 {start|stop} ..." |
890 |
;; |
;; |
891 |
esac |
esac |
|
|
|