--- alx-src/branches/alxconf-060/init.d/alxsettings 2011/05/17 21:41:48 2156 +++ alx-src/branches/alxconf-060/init.d/alxsettings 2012/04/13 17:13:05 3459 @@ -26,17 +26,18 @@ source /etc/alxconfig-ng/config.rc # helper functions -source /usr/lib/alxconfig-ng/functions/common -source /usr/lib/alxconfig-ng/functions/mysqlfunctions -source /usr/lib/alxconfig-ng/functions/serial_functions -source /usr/lib/alxconfig-ng/functions/config_modules -source /usr/lib/alxconfig-ng/functions/config_network -source /usr/lib/alxconfig-ng/functions/config_printers -source /usr/lib/alxconfig-ng/functions/config_sessions -source /usr/lib/alxconfig-ng/functions/config_x11 -source /usr/lib/alxconfig-ng/functions/config_auth -source /usr/lib/alxconfig-ng/functions/config_ssh_auth -source /usr/lib/alxconfig-ng/functions/config_versions +source ${ALX_FUNCTIONS}/common +source ${ALX_FUNCTIONS}/mysqlfunctions +source ${ALX_FUNCTIONS}/serial_functions +source ${ALX_FUNCTIONS}/config_modules +source ${ALX_FUNCTIONS}/config_plugins +source ${ALX_FUNCTIONS}/config_network +source ${ALX_FUNCTIONS}/config_printers +source ${ALX_FUNCTIONS}/config_sessions +source ${ALX_FUNCTIONS}/config_x11 +source ${ALX_FUNCTIONS}/config_auth +source ${ALX_FUNCTIONS}/config_ssh_auth +source ${ALX_FUNCTIONS}/config_versions # other needed vars ALX_HW_DETECT=false @@ -51,20 +52,6 @@ # setup needed directories [ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state - -# read_cmdline ${item} -read_cmdline() -{ - local i - - for i in $(< /proc/cmdline) - do - [[ ${i} = $1 ]] && return 0 - done - - return 1 -} - update_system_settings() { rc_mecho Checking system setup ... @@ -73,6 +60,9 @@ # ! is the first thing that must be configured ! config_modules + # install or uninstall plugins + config_plugins + # imports network settings from db config_networking @@ -179,8 +169,8 @@ fi - CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') - CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) + CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp') + CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11) CUR_MTIME=$(date +%s) # abort now if this is a forced re-check @@ -434,8 +424,8 @@ local alx_os local alx_utils alx_os="$(< /etc/mageversion)" - alx_utils="$(magequery -n alxconfig-ng-alx | sed 's:.*\[\ \(.*\)\ \].*:\1:')" - alx_utils="${alx_utils/alxconfig-ng-alx-}" + alx_utils="$(magequery -n alxconfig-ng | sed 's:.*\[\ \(.*\)\ \].*:\1:')" + alx_utils="${alx_utils/alxconfig-ng-}" mysqldo "insert into client_version(serial,os,utils) values('${ALX_SERIAL}','${alx_os}','${alx_utils}')" evaluate_retval @@ -565,7 +555,16 @@ then # set an device alias for modprobe.conf [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d - echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modprobe.d/net.eth0.conf + # update only if not the same (to speed up bootprocess - no depmod) + CONFIG="/etc/modprobe.d/net.${ALX_IFACE}.conf" + clearconfig + addconfig "alias ${ALX_IFACE} ${cfg_network_module}" + + # update confd-networking default iface + [ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH} + CONFIG="${SETTINGSPATH}/confd-networking" + clearconfig + addconfig "${ALX_IFACE}" # regenerate modprobe.conf [ -x $(which modules-update) ] && modules-update || rc_echo "modules-update not found!" @@ -588,10 +587,38 @@ # now generate fluxbox config files # fluxbox main config - cat ${ALX_SKELETONS}/fluxbox/init > ${ALX_UNPRIV_HOME}/.fluxbox/init + local fbinit + if [ -f ${ALX_SKELETONS}/fluxbox/init ] + then + fbinit="${ALX_SKELETONS}/fluxbox/init" + else + fbinit="/usr/share/fluxbox/init" + fi + cat ${fbinit} > ${ALX_UNPRIV_HOME}/.fluxbox/init # fluxbox autostart - cat ${ALX_SKELETONS}/fluxbox/apps > ${ALX_UNPRIV_HOME}/.fluxbox/apps + CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps" + # do not show decorations on messages generated with xmessage + if [ -x /usr/bin/xmessage ] + then + addconfig '[app] (xmessage)' + addconfig ' [Deco] {NONE}' + addconfig '[end]' + fi + # add icon utility + [ -x /usr/bin/idesk ] && addconfig '[startup] {nohup idesk > /dev/null &}' + # add numlock utility + [ -x /usr/bin/numlockx ] && addconfig '[startup] {nohup numlockx on &}' + + # fluxbox hotkeys + local fbkeys + if [ -f ${ALX_SKELETONS}/fluxbox/keys ] + then + fbkeys="${ALX_SKELETONS}/fluxbox/keys" + else + fbkeys="/usr/share/fluxbox/keys" + fi + cat ${fbkeys} > ${ALX_UNPRIV_HOME}/.fluxbox/keys # fluxbox menu header cat ${ALX_SKELETONS}/fluxbox/menu.header > ${ALX_UNPRIV_HOME}/.fluxbox/menu @@ -609,14 +636,33 @@ # add a newline (maybe there is no crlf in the footer) echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu - # setup some standart icons (sysinfo.lnk) - # basic config - cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc - # clean desktop icon location - [ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop - install -d ${ALX_UNPRIV_HOME}/.xtdesktop + [ -d ${ALX_UNPRIV_HOME}/.idesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.idesktop + install -d ${ALX_UNPRIV_HOME}/.idesktop + + # add shutdown, reboot icons + local name + # default settings + declare -i x=30 + declare -i y=30 + for i in shutdown reboot + do + case ${i} in + shutdown) name="Herunterfahren" ;; + reboot) name="Neustarten" ;; + esac + + generate_icon \ + --name "${name}" \ + --command "/usr/lib/alxconfig-ng/bin/user_${i}.sh" \ + --icon "${ALX_SESSIONS_ICONS}/${i}.png" \ + --dest "${dest}/${i}.lnk" \ + --xres "${x}" \ + --yres "${y}" + + y=$((${y} + 80)) + done # last but not least gen a icon with some sys informations local sysinfo @@ -638,22 +684,21 @@ --name "${sysinfo}" \ --command "exit 0" \ --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ - --dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \ + --dest "${ALX_UNPRIV_HOME}/.idesktop/sysinfo.lnk" \ --xres "${xres}" \ --yres "${yres}" \ --icon-width "1" \ --icon-height "1" - # create a xinitrc - echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc - # set correct permissions chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox - chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop - chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc - chmod 0644 ${ALX_UNPRIV_HOME}/.xinitrc + chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop + if [ -f ${ALX_UNPRIV_HOME}/.ideskrc ] + then + chmod 0644 ${ALX_UNPRIV_HOME}/.ideskrc + fi } # start|stop @@ -702,7 +747,7 @@ ${rc_base}/init.d/network start else rc_print "Starting default dhcp based networking ... " - ${ALX_DHCP_PROG} ${ALX_DHCP_START} &> /dev/null + ${ALX_DHCP_PROG} ${ALX_DHCP_START} ${ALX_IFACE} &> /dev/null evaluate_retval fi ;; @@ -733,27 +778,28 @@ reset_system_settings() { # force load of de kbdkeys - loadkeys -q de + [ -x /usr/bin/loadkeys ] && loadkeys -q de + [ -x /sbin/loadkmap ] && loadkmap < /usr/share/busybox/keymaps/de.kmap rc_echo - rc_echo -en ${COLRED} - rc_echo -n "*** Warning: you are about to reset *all* local settings on this system!" - rc_echo -e ${COLDEFAULT} - rc_echo "*** Do you really want to continue ?" - rc_echo -n "*** Enter 'yes' to continue, anything else to abort: " + rc_echo -en "${COLRED}" + rc_echo -n '--- Warning: you are about to reset *all* local settings on this system!' + rc_echo -e "${COLDEFAULT}" + rc_echo '--- Do you really want to continue ?' + rc_echo -n '--- Enter 'yes' to continue, anything else to abort: ' read kbinsert if [[ ${kbinsert} = yes ]] then - rc_echo -en ${COLRED} - rc_echo -n "*** OK, you really want it ... killing all settings: " + rc_echo -en "${COLRED}" + rc_echo -n '--- OK, you really want it ... killing all settings: ' for i in 3 2 1 now do rc_echo -n " ${i}" sleep 1 done - rc_echo -e ${COLDEFAULT} + rc_echo -e "${COLDEFAULT}" ## reset all settings: - rm -rf ${SETTINGSPATH}/* + rm -rf ${SETTINGSPATH} rm -f /etc/alxconfig-ng/serial rm -rf /etc/alxconfig-ng/state @@ -767,11 +813,11 @@ [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME} # remove all ica-sessions - find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs rm + find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs --no-run-if-empty rm # remove all old nics and modules configs - find /etc/conf.d -type f -name 'net.*' | xargs rm - find /etc/modprobe.d -type f -name 'net.*' | xargs rm + find /etc/conf.d -type f -name 'net.*' | xargs --no-run-if-empty rm + find /etc/modprobe.d -type f -name 'net.*' | xargs --no-run-if-empty rm # restore default networking cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0