26 |
source /etc/alxconfig-ng/config.rc |
source /etc/alxconfig-ng/config.rc |
27 |
|
|
28 |
# helper functions |
# helper functions |
29 |
source /usr/lib/alxconfig-ng/functions/common |
source ${ALX_FUNCTIONS}/common |
30 |
source /usr/lib/alxconfig-ng/functions/mysqlfunctions |
source ${ALX_FUNCTIONS}/mysqlfunctions |
31 |
source /usr/lib/alxconfig-ng/functions/serial_functions |
source ${ALX_FUNCTIONS}/serial_functions |
32 |
source /usr/lib/alxconfig-ng/functions/config_modules |
source ${ALX_FUNCTIONS}/config_modules |
33 |
source /usr/lib/alxconfig-ng/functions/config_network |
source ${ALX_FUNCTIONS}/config_plugins |
34 |
source /usr/lib/alxconfig-ng/functions/config_printers |
source ${ALX_FUNCTIONS}/config_network |
35 |
source /usr/lib/alxconfig-ng/functions/config_sessions |
source ${ALX_FUNCTIONS}/config_printers |
36 |
source /usr/lib/alxconfig-ng/functions/config_x11 |
source ${ALX_FUNCTIONS}/config_sessions |
37 |
source /usr/lib/alxconfig-ng/functions/config_auth |
source ${ALX_FUNCTIONS}/config_x11 |
38 |
source /usr/lib/alxconfig-ng/functions/config_ssh_auth |
source ${ALX_FUNCTIONS}/config_auth |
39 |
source /usr/lib/alxconfig-ng/functions/config_versions |
source ${ALX_FUNCTIONS}/config_ssh_auth |
40 |
|
source ${ALX_FUNCTIONS}/config_versions |
41 |
|
|
42 |
# other needed vars |
# other needed vars |
43 |
ALX_HW_DETECT=false |
ALX_HW_DETECT=false |
52 |
# setup needed directories |
# setup needed directories |
53 |
[ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state |
[ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state |
54 |
|
|
|
|
|
|
# read_cmdline ${item} |
|
|
read_cmdline() |
|
|
{ |
|
|
local i |
|
|
|
|
|
for i in $(< /proc/cmdline) |
|
|
do |
|
|
[[ ${i} = $1 ]] && return 0 |
|
|
done |
|
|
|
|
|
return 1 |
|
|
} |
|
|
|
|
55 |
update_system_settings() |
update_system_settings() |
56 |
{ |
{ |
57 |
rc_mecho Checking system setup ... |
rc_mecho Checking system setup ... |
60 |
# ! is the first thing that must be configured ! |
# ! is the first thing that must be configured ! |
61 |
config_modules |
config_modules |
62 |
|
|
63 |
|
# install or uninstall plugins |
64 |
|
config_plugins |
65 |
|
|
66 |
# imports network settings from db |
# imports network settings from db |
67 |
config_networking |
config_networking |
68 |
|
|
169 |
fi |
fi |
170 |
|
|
171 |
|
|
172 |
CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp') |
173 |
CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) |
CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11) |
174 |
CUR_MTIME=$(date +%s) |
CUR_MTIME=$(date +%s) |
175 |
|
|
176 |
# abort now if this is a forced re-check |
# abort now if this is a forced re-check |
424 |
local alx_os |
local alx_os |
425 |
local alx_utils |
local alx_utils |
426 |
alx_os="$(< /etc/mageversion)" |
alx_os="$(< /etc/mageversion)" |
427 |
alx_utils="$(magequery -n alxconfig-ng-alx | sed 's:.*\[\ \(.*\)\ \].*:\1:')" |
alx_utils="$(magequery -n alxconfig-ng | sed 's:.*\[\ \(.*\)\ \].*:\1:')" |
428 |
alx_utils="${alx_utils/alxconfig-ng-alx-}" |
alx_utils="${alx_utils/alxconfig-ng-}" |
429 |
mysqldo "insert into client_version(serial,os,utils) values('${ALX_SERIAL}','${alx_os}','${alx_utils}')" |
mysqldo "insert into client_version(serial,os,utils) values('${ALX_SERIAL}','${alx_os}','${alx_utils}')" |
430 |
|
|
431 |
evaluate_retval |
evaluate_retval |
555 |
then |
then |
556 |
# set an device alias for modprobe.conf |
# set an device alias for modprobe.conf |
557 |
[ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d |
[ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d |
558 |
echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modprobe.d/net.eth0.conf |
# update only if not the same (to speed up bootprocess - no depmod) |
559 |
|
CONFIG="/etc/modprobe.d/net.${ALX_IFACE}.conf" |
560 |
|
clearconfig |
561 |
|
addconfig "alias ${ALX_IFACE} ${cfg_network_module}" |
562 |
|
|
563 |
|
# update confd-networking default iface |
564 |
|
[ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH} |
565 |
|
CONFIG="${SETTINGSPATH}/confd-networking" |
566 |
|
clearconfig |
567 |
|
addconfig "${ALX_IFACE}" |
568 |
|
|
569 |
# regenerate modprobe.conf |
# regenerate modprobe.conf |
570 |
[ -x $(which modules-update) ] && modules-update || rc_echo "modules-update not found!" |
[ -x $(which modules-update) ] && modules-update || rc_echo "modules-update not found!" |
587 |
# now generate fluxbox config files |
# now generate fluxbox config files |
588 |
|
|
589 |
# fluxbox main config |
# fluxbox main config |
590 |
cat ${ALX_SKELETONS}/fluxbox/init > ${ALX_UNPRIV_HOME}/.fluxbox/init |
local fbinit |
591 |
|
if [ -f ${ALX_SKELETONS}/fluxbox/init ] |
592 |
|
then |
593 |
|
fbinit="${ALX_SKELETONS}/fluxbox/init" |
594 |
|
else |
595 |
|
fbinit="/usr/share/fluxbox/init" |
596 |
|
fi |
597 |
|
cat ${fbinit} > ${ALX_UNPRIV_HOME}/.fluxbox/init |
598 |
|
|
599 |
# fluxbox autostart |
# fluxbox autostart |
600 |
cat ${ALX_SKELETONS}/fluxbox/apps > ${ALX_UNPRIV_HOME}/.fluxbox/apps |
CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps" |
601 |
|
# do not show decorations on messages generated with xmessage |
602 |
|
if [ -x /usr/bin/xmessage ] |
603 |
|
then |
604 |
|
addconfig '[app] (xmessage)' |
605 |
|
addconfig ' [Deco] {NONE}' |
606 |
|
addconfig '[end]' |
607 |
|
fi |
608 |
|
# add icon utility |
609 |
|
[ -x /usr/bin/idesk ] && addconfig '[startup] {nohup idesk > /dev/null &}' |
610 |
|
# add numlock utility |
611 |
|
[ -x /usr/bin/numlockx ] && addconfig '[startup] {nohup numlockx on &}' |
612 |
|
|
613 |
|
# fluxbox hotkeys |
614 |
|
local fbkeys |
615 |
|
if [ -f ${ALX_SKELETONS}/fluxbox/keys ] |
616 |
|
then |
617 |
|
fbkeys="${ALX_SKELETONS}/fluxbox/keys" |
618 |
|
else |
619 |
|
fbkeys="/usr/share/fluxbox/keys" |
620 |
|
fi |
621 |
|
cat ${fbkeys} > ${ALX_UNPRIV_HOME}/.fluxbox/keys |
622 |
|
|
623 |
# fluxbox menu header |
# fluxbox menu header |
624 |
cat ${ALX_SKELETONS}/fluxbox/menu.header > ${ALX_UNPRIV_HOME}/.fluxbox/menu |
cat ${ALX_SKELETONS}/fluxbox/menu.header > ${ALX_UNPRIV_HOME}/.fluxbox/menu |
636 |
# add a newline (maybe there is no crlf in the footer) |
# add a newline (maybe there is no crlf in the footer) |
637 |
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
638 |
|
|
|
|
|
639 |
# setup some standart icons (sysinfo.lnk) |
# setup some standart icons (sysinfo.lnk) |
|
# basic config |
|
|
cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc |
|
|
|
|
640 |
# clean desktop icon location |
# clean desktop icon location |
641 |
[ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop |
[ -d ${ALX_UNPRIV_HOME}/.idesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.idesktop |
642 |
install -d ${ALX_UNPRIV_HOME}/.xtdesktop |
install -d ${ALX_UNPRIV_HOME}/.idesktop |
643 |
|
|
644 |
|
# add shutdown, reboot icons |
645 |
|
local name |
646 |
|
# default settings |
647 |
|
declare -i x=30 |
648 |
|
declare -i y=30 |
649 |
|
for i in shutdown reboot |
650 |
|
do |
651 |
|
case ${i} in |
652 |
|
shutdown) name="Herunterfahren" ;; |
653 |
|
reboot) name="Neustarten" ;; |
654 |
|
esac |
655 |
|
|
656 |
|
generate_icon \ |
657 |
|
--name "${name}" \ |
658 |
|
--command "/usr/lib/alxconfig-ng/bin/user_${i}.sh" \ |
659 |
|
--icon "${ALX_SESSIONS_ICONS}/${i}.png" \ |
660 |
|
--dest "${dest}/${i}.lnk" \ |
661 |
|
--xres "${x}" \ |
662 |
|
--yres "${y}" |
663 |
|
|
664 |
|
y=$((${y} + 80)) |
665 |
|
done |
666 |
|
|
667 |
# last but not least gen a icon with some sys informations |
# last but not least gen a icon with some sys informations |
668 |
local sysinfo |
local sysinfo |
684 |
--name "${sysinfo}" \ |
--name "${sysinfo}" \ |
685 |
--command "exit 0" \ |
--command "exit 0" \ |
686 |
--icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ |
--icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ |
687 |
--dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \ |
--dest "${ALX_UNPRIV_HOME}/.idesktop/sysinfo.lnk" \ |
688 |
--xres "${xres}" \ |
--xres "${xres}" \ |
689 |
--yres "${yres}" \ |
--yres "${yres}" \ |
690 |
--icon-width "1" \ |
--icon-width "1" \ |
691 |
--icon-height "1" |
--icon-height "1" |
692 |
|
|
|
# create a xinitrc |
|
|
echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc |
|
|
|
|
693 |
# set correct permissions |
# set correct permissions |
694 |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
695 |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
696 |
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
697 |
chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop |
chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop |
698 |
chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc |
if [ -f ${ALX_UNPRIV_HOME}/.ideskrc ] |
699 |
chmod 0644 ${ALX_UNPRIV_HOME}/.xinitrc |
then |
700 |
|
chmod 0644 ${ALX_UNPRIV_HOME}/.ideskrc |
701 |
|
fi |
702 |
} |
} |
703 |
|
|
704 |
# start|stop |
# start|stop |
731 |
# keeping like always safe: |
# keeping like always safe: |
732 |
# no network should be startet here, |
# no network should be startet here, |
733 |
# so we can delete all pid files if one exists |
# so we can delete all pid files if one exists |
734 |
if [[ ! -z $(pidof udhcpc) ]] |
if [[ ! -z $(pidof $(basename ${ALX_DHCP_PROG})) ]] |
735 |
then |
then |
736 |
rc_mecho "Forcing network down" |
rc_mecho "Forcing network down" |
737 |
killall udhcpc &> /dev/null |
killall $(basename ${ALX_DHCP_PROG}) &> /dev/null |
738 |
sleep 1 |
sleep 1 |
739 |
fi |
fi |
740 |
[[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop |
[[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop |
747 |
${rc_base}/init.d/network start |
${rc_base}/init.d/network start |
748 |
else |
else |
749 |
rc_print "Starting default dhcp based networking ... " |
rc_print "Starting default dhcp based networking ... " |
750 |
# -t 10 timeout of 10 secs |
${ALX_DHCP_PROG} ${ALX_DHCP_START} ${ALX_IFACE} &> /dev/null |
|
udhcpc -t 10 &> /dev/null |
|
751 |
evaluate_retval |
evaluate_retval |
752 |
fi |
fi |
753 |
;; |
;; |
759 |
${rc_base}/init.d/network stop |
${rc_base}/init.d/network stop |
760 |
else |
else |
761 |
rc_print "Stopping default dhcp based networking ... " |
rc_print "Stopping default dhcp based networking ... " |
762 |
ifconfig eth0 down |
ifconfig ${ALX_IFACE} down |
763 |
fi |
fi |
764 |
if [[ ! -z $(pidof udhcpc) ]] |
if [[ ! -z $(pidof $(basename ${ALX_DHCP_PROG})) ]] |
765 |
then |
then |
766 |
killall udhcpc &> /dev/null |
killall $(basename ${ALX_DHCP_PROG}) &> /dev/null |
767 |
sleep 1 |
sleep 1 |
768 |
fi |
fi |
769 |
evaluate_retval |
evaluate_retval |
812 |
[ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME} |
[ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME} |
813 |
|
|
814 |
# remove all ica-sessions |
# remove all ica-sessions |
815 |
find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs rm |
find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs --no-run-if-empty rm |
816 |
|
|
817 |
# remove all old nics and modules configs |
# remove all old nics and modules configs |
818 |
find /etc/conf.d -type f -name 'net.*' | xargs rm |
find /etc/conf.d -type f -name 'net.*' | xargs --no-run-if-empty rm |
819 |
find /etc/modprobe.d -type f -name 'net.*' | xargs rm |
find /etc/modprobe.d -type f -name 'net.*' | xargs --no-run-if-empty rm |
820 |
|
|
821 |
# restore default networking |
# restore default networking |
822 |
cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0 |
cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0 |