Magellan Linux

Diff of /alx-src/branches/alxconf-060/init.d/alxsettings

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

alx-src/trunk/alxconfig-ng/init.d/alxsettings revision 348 by niro, Sun Oct 9 21:38:14 2005 UTC alx-src/branches/alxconf_20060908/init.d/alxsettings revision 1715 by niro, Tue Jan 25 09:36:42 2011 UTC
# Line 11  Line 11 
11  #%before:  #%before:
12  #%after:  #%after:
13    
14  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.23 2005-10-09 21:38:14 niro Exp $  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.27 2005-10-11 12:10:15 niro Exp $
15    
16  # checks first if the client was already configured and if it has an valid serial  # checks first if the client was already configured and if it has an valid serial
17  # if not it runs the autoconfiguration script  # if not it runs the autoconfiguration script
# Line 37  source /usr/lib/alxconfig-ng/functions/c Line 37  source /usr/lib/alxconfig-ng/functions/c
37  source /usr/lib/alxconfig-ng/functions/config_x11  source /usr/lib/alxconfig-ng/functions/config_x11
38  source /usr/lib/alxconfig-ng/functions/config_auth  source /usr/lib/alxconfig-ng/functions/config_auth
39  source /usr/lib/alxconfig-ng/functions/config_ssh_auth  source /usr/lib/alxconfig-ng/functions/config_ssh_auth
40    source /usr/lib/alxconfig-ng/functions/config_versions
41    
42  # check if mysql is available  # check if mysql is available
43  [ -x /usr/bin/mysql ] && MYSQL_ALX=true  [ -x /usr/bin/mysql ] && MYSQL_ALX=true
# Line 93  update_system_settings() Line 94  update_system_settings()
94    
95   # exchange ssh rsa keys   # exchange ssh rsa keys
96   HOME=/root config_ssh_auth   HOME=/root config_ssh_auth
97    
98     # import version info
99     config_version
100  }  }
101    
102  get_system_serial()  get_system_serial()
103  {  {
104   local CUR_IP CUR_MAC CUR_MTIME   local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE
105    
106     if [[ ${ALX_CONFD_NETWORKING} = true ]]
107     then
108     ALX_IFACE="$(< ${SETTINGSPATH}/confd-networking)"
109     else
110     ALX_IFACE="eth0"
111     fi
112    
113   # check if serial file exists   # check if serial file exists
114   if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]]   if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]]
# Line 132  get_system_serial() Line 143  get_system_serial()
143   else   else
144   # abort on non valid serial   # abort on non valid serial
145   ALX_STATE="invalid serial"   ALX_STATE="invalid serial"
146   echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state
147   show_invalid_serial_msg   show_invalid_serial_msg
148   exit 1   exit 1
149   fi   fi
# Line 143  get_system_serial() Line 154  get_system_serial()
154   if [[ ${ALX_FORCED_RECHECK} = true ]]   if [[ ${ALX_FORCED_RECHECK} = true ]]
155   then   then
156   echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT}   echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT}
157     # always disable CONFD_NETWORKING here
158     export ALX_CONFD_NETWORKING="false"
159   else   else
160   echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT}   echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT}
161   fi   fi
# Line 198  get_system_serial() Line 211  get_system_serial()
211   fi   fi
212    
213   # write current state to temp file   # write current state to temp file
214   echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state
215   [ -f /hardware-auto-detection ] && rm /hardware-auto-detection   [ -f /hardware-auto-detection ] && rm /hardware-auto-detection
216    
217   # now export ALX_FORCED_RECHECK=true   # now export ALX_FORCED_RECHECK=true
# Line 223  get_system_serial() Line 236  get_system_serial()
236   # set ALX_STATE to ok so everybody knows that everything was ok   # set ALX_STATE to ok so everybody knows that everything was ok
237   ALX_STATE=ok   ALX_STATE=ok
238    
239   echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial   echo "ALX_SERIAL=\"${ALX_SERIAL}\"" > /etc/alxconfig-ng/serial
240   echo "ALX_REG_DATE=${CUR_MTIME}" >> /etc/alxconfig-ng/serial   echo "ALX_REG_DATE=\"${CUR_MTIME}\"" >> /etc/alxconfig-ng/serial
241    
242   evaluate_retval   evaluate_retval
243   else   else
# Line 243  get_system_serial() Line 256  get_system_serial()
256   fi   fi
257    
258   # write current state to temp file   # write current state to temp file
259   echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state
260   echo "ALX_IFACE=${ALX_IFACE}" >> /etc/alxconfig-ng/state/state   echo "ALX_IFACE=\"${ALX_IFACE}\"" >> /etc/alxconfig-ng/state/state
261  }  }
262    
263    
# Line 370  import_settings_to_db() Line 383  import_settings_to_db()
383   module,   module,
384   resolution,   resolution,
385   depth,   depth,
386   monitorid   refresh_rate
387   )   )
388   values(   values(
389   '${ALX_SERIAL}',   '${ALX_SERIAL}',
390   '${XMODULE}',   '${XMODULE}',
391   '1024x768',   '1024x768',
392   '16',   '16',
393   '0'   '60'
394   );"; )   );"; )
395   evaluate_retval   evaluate_retval
396    
# Line 420  import_settings_to_db() Line 433  import_settings_to_db()
433   echo -e "      Screensaver settings ..."   echo -e "      Screensaver settings ..."
434   mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')"   mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')"
435    
436     # version info
437     local alx_os
438     local alx_utils
439     alx_os="$(< /etc/mageversion)"
440     alx_utils="$(magequery -n alxconfig-ng-alx | sed 's:.*\[\ \(.*\)\ \].*:\1:')"
441     alx_utils="${alx_utils/alxconfig-ng-alx-}"
442     mysqldo "insert into client_version(serial,os,utils) values('${ALX_SERIAL}','${alx_os}','${alx_utils}')"
443    
444   evaluate_retval   evaluate_retval
445  }  }
446    
# Line 502  update_settings_in_db() Line 523  update_settings_in_db()
523   module='${XMODULE}',   module='${XMODULE}',
524   resolution='1024x768',   resolution='1024x768',
525   depth='16',   depth='16',
526   monitorid='0'   refresh_rate='60'
527   where serial=${ALX_SERIAL};"   where serial=${ALX_SERIAL};"
528   evaluate_retval   evaluate_retval
529    
# Line 510  update_settings_in_db() Line 531  update_settings_in_db()
531   echo -e "      Input settings ..."   echo -e "      Input settings ..."
532   mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};"   mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};"
533   evaluate_retval   evaluate_retval
534    
535     # version info
536     local alx_os
537     local alx_utils
538     alx_os="$(< /etc/mageversion)"
539     alx_utils="$(magequery -n alxconfig-ng-alx | sed 's:.*\[\ \(.*\)\ \].*:\1:')"
540     alx_utils="${alx_utils/alxconfig-ng-alx-}"
541     mysqldo "update client_version set os='${alx_os}', utils='${alx_utils}' where serial=${ALX_SERIAL};"
542  }  }
543    
544  # imports current settings to the local system resolved by the hardware detection  # imports current settings to the local system resolved by the hardware detection
# Line 539  import_settings_local() Line 568  import_settings_local()
568   #[ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}   #[ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}
569   #echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules   #echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules
570    
571   # set an device alias for modprobe.conf   # set an device alias for modprobe.conf and modules.conf
572   [ ! -d /etc/modules.d ] && install -d /etc/modules.d   [ ! -d /etc/modules.d ] && install -d /etc/modules.d
573     [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d
574   echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modules.d/net.eth0   echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modules.d/net.eth0
575     echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modprobe.d/net.eth0
576    
577   # regenerate modprobe.conf   # regenerate modprobe.conf
578   [ -x $(which modules-update) ] && modules-update || echo "cannot regen modprobe.conf"   [ -x $(which modules-update) ] && modules-update || echo "cannot regen modprobe.conf"
# Line 551  import_settings_local() Line 582  import_settings_local()
582   # set system state to 'already configured'   # set system state to 'already configured'
583   touch /etc/alxconfig-ng/state/configured   touch /etc/alxconfig-ng/state/configured
584    
585     # install slim desktopmanager configuration
586     cat ${ALX_SKELETONS}/slim/slim.conf > /etc/slim.conf
587     sed -i "s:@@USERNAME@@:${ALX_UNPRIV_USER}:" /etc/slim.conf
588    
589     # install a sane xinitrc
590     echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc
591    
592   # if only an recheck was forced than abort now   # if only an recheck was forced than abort now
593   [[ ${ALX_FORCED_RECHECK} = true ]] && return 0   [[ ${ALX_FORCED_RECHECK} = true ]] && return 0
594    
# Line 622  import_settings_local() Line 660  import_settings_local()
660   --icon-width "1" \   --icon-width "1" \
661   --icon-height "1"   --icon-height "1"
662    
663     # create a xinitrc
664     echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc
665    
666   # set correct permissions   # set correct permissions
667   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}
668   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox
669   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox
670   chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop   chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop
671   chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc   chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc
672     chmod 0644 ${ALX_UNPRIV_HOME}/.xinitrc
673  }  }
674    
675  # start|stop  # start|stop
# Line 696  preliminary_network() Line 738  preliminary_network()
738   if ps -A|grep dhcpcd > /dev/null   if ps -A|grep dhcpcd > /dev/null
739   then   then
740   dhcpcd -z  &> /dev/null   dhcpcd -z  &> /dev/null
741     sleep 1
742   fi   fi
743   evaluate_retval   evaluate_retval
744   ;;   ;;
# Line 733  reset_system_settings() Line 776  reset_system_settings()
776   rm -f /etc/alxconfig-ng/serial   rm -f /etc/alxconfig-ng/serial
777   rm -rf /etc/alxconfig-ng/state   rm -rf /etc/alxconfig-ng/state
778    
779     # clear all printers & net-shares
780     :> /etc/cups/printers.conf
781     :> /etc/samba/smb.conf
782    
783     # remove inetd, cups & smb from init
784     rc-config del inetd &> /dev/null
785     rc-config del cups &> /dev/null
786     rc-config del samba &> /dev/null
787    
788     # remove all user settings
789     [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}
790    
791     # remove all ica-sessions
792     find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs rm
793    
794     # remove all old nics and modules configs
795     find /etc/conf.d -type f -name 'net.*' | xargs rm
796     find /etc/modules.d -type f -name 'net.*' | xargs rm
797    
798     # restore default networking
799     cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0
800    
801   echo "I am done now, press [Enter] to reboot system ..."   echo "I am done now, press [Enter] to reboot system ..."
802   else   else
803   echo "Aborted, press [Enter] to reboot system ..."   echo "Aborted, press [Enter] to reboot system ..."

Legend:
Removed from v.348  
changed lines
  Added in v.1715