Magellan Linux

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

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

revision 2479 by niro, Mon Jun 27 15:20:33 2011 UTC revision 3466 by niro, Fri Apr 13 17:27:25 2012 UTC
# Line 26  source $rc_functions Line 26  source $rc_functions
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
# Line 59  update_system_settings() Line 60  update_system_settings()
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    
# Line 83  update_system_settings() Line 87  update_system_settings()
87    
88  get_system_serial()  get_system_serial()
89  {  {
90   local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE   local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE CONFIG
91    
92   if [[ ${ALX_CONFD_NETWORKING} = true ]]   if [[ ${ALX_CONFD_NETWORKING} = true ]]
93   then   then
# Line 125  get_system_serial() Line 129  get_system_serial()
129   else   else
130   # abort on non valid serial   # abort on non valid serial
131   ALX_STATE="invalid serial"   ALX_STATE="invalid serial"
132   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state   CONFIG="/etc/alxconfig-ng/state/state"
133     clearconfig
134     addconfig "ALX_STATE=\"${ALX_STATE}\""
135   show_invalid_serial_msg   show_invalid_serial_msg
136   exit 1   exit 1
137   fi   fi
# Line 151  get_system_serial() Line 157  get_system_serial()
157   HOSTNAME="${ALX_DEFAULT_HOSTNAME}"   HOSTNAME="${ALX_DEFAULT_HOSTNAME}"
158    
159   # update the hostname on the system for sure   # update the hostname on the system for sure
160   echo "${HOSTNAME}" > /etc/hostname   CONFIG="/etc/hostname"
161     clearconfig
162     addconfig "${HOSTNAME}"
163    
164   # start preliminary networking (dhcp)   # start preliminary networking (dhcp)
165   preliminary_network start   preliminary_network start
# Line 164  get_system_serial() Line 172  get_system_serial()
172   exit 1   exit 1
173   fi   fi
174    
175     CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp')
176   CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')   CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11)
  CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11)  
177   CUR_MTIME=$(date +%s)   CUR_MTIME=$(date +%s)
178    
179   # abort now if this is a forced re-check   # abort now if this is a forced re-check
# Line 188  get_system_serial() Line 195  get_system_serial()
195   else   else
196   # abort on non valid serial   # abort on non valid serial
197   ALX_STATE="invalid serial"   ALX_STATE="invalid serial"
198   echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state   CONFIG="/etc/alxconfig-ng/state/state"
199     clearconfig
200     addconfig "ALX_STATE=\"${ALX_STATE}\""
201   show_invalid_serial_msg   show_invalid_serial_msg
202   exit 1   exit 1
203   fi   fi
204    
205   # write current state to temp file   # write current state to temp file
206   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state   CONFIG="/etc/alxconfig-ng/state/state"
207     clearconfig
208     addconfig "ALX_STATE=\"${ALX_STATE}\""
209   [ -f /hardware-auto-detection ] && rm /hardware-auto-detection   [ -f /hardware-auto-detection ] && rm /hardware-auto-detection
210    
211   # now export ALX_FORCED_RECHECK=true   # now export ALX_FORCED_RECHECK=true
# Line 219  get_system_serial() Line 230  get_system_serial()
230   # set ALX_STATE to ok so everybody knows that everything was ok   # set ALX_STATE to ok so everybody knows that everything was ok
231   ALX_STATE=ok   ALX_STATE=ok
232    
233   echo "ALX_SERIAL=\"${ALX_SERIAL}\"" > /etc/alxconfig-ng/serial   CONFIG="/etc/alxconfig-ng/serial"
234   echo "ALX_REG_DATE=\"${CUR_MTIME}\"" >> /etc/alxconfig-ng/serial   clearconfig
235     addconfig "ALX_SERIAL=\"${ALX_SERIAL}\""
236     addconfig "ALX_REG_DATE=\"${CUR_MTIME}\""
237    
238   evaluate_retval   evaluate_retval
239   else   else
# Line 239  get_system_serial() Line 252  get_system_serial()
252   fi   fi
253    
254   # write current state to temp file   # write current state to temp file
255   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state   CONFIG="/etc/alxconfig-ng/state/state"
256   echo "ALX_IFACE=\"${ALX_IFACE}\"" >> /etc/alxconfig-ng/state/state   clearconfig
257     addconfig "ALX_STATE=\"${ALX_STATE}\""
258     addconfig "ALX_IFACE=\"${ALX_IFACE}\""
259  }  }
260    
261    
# Line 420  import_settings_to_db() Line 435  import_settings_to_db()
435   local alx_os   local alx_os
436   local alx_utils   local alx_utils
437   alx_os="$(< /etc/mageversion)"   alx_os="$(< /etc/mageversion)"
438   alx_utils="$(magequery -n alxconfig-ng-alx | sed 's:.*\[\ \(.*\)\ \].*:\1:')"   alx_utils="$(magequery -n alxconfig-ng | sed 's:.*\[\ \(.*\)\ \].*:\1:')"
439   alx_utils="${alx_utils/alxconfig-ng-alx-}"   alx_utils="${alx_utils/alxconfig-ng-}"
440   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}')"
441    
442   evaluate_retval   evaluate_retval
# Line 551  import_settings_local() Line 566  import_settings_local()
566   then   then
567   # set an device alias for modprobe.conf   # set an device alias for modprobe.conf
568   [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d   [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d
569   echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modprobe.d/net.eth0.conf   # update only if not the same (to speed up bootprocess - no depmod)
570     CONFIG="/etc/modprobe.d/net.${ALX_IFACE}.conf"
571     clearconfig
572     addconfig "alias ${ALX_IFACE} ${cfg_network_module}"
573    
574     # update confd-networking default iface
575     [ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}
576     CONFIG="${SETTINGSPATH}/confd-networking"
577     clearconfig
578     addconfig "${ALX_IFACE}"
579    
580   # regenerate modprobe.conf   # regenerate modprobe.conf
581   [ -x $(which modules-update) ] && modules-update || rc_echo "modules-update not found!"   [ -x $(which modules-update) ] && modules-update || rc_echo "modules-update not found!"
# Line 734  preliminary_network() Line 758  preliminary_network()
758   ${rc_base}/init.d/network start   ${rc_base}/init.d/network start
759   else   else
760   rc_print "Starting default dhcp based networking ... "   rc_print "Starting default dhcp based networking ... "
761   ${ALX_DHCP_PROG} ${ALX_DHCP_START} &> /dev/null   ${ALX_DHCP_PROG} ${ALX_DHCP_START} ${ALX_IFACE} &> /dev/null
762   evaluate_retval   evaluate_retval
763   fi   fi
764   ;;   ;;
# Line 765  preliminary_network() Line 789  preliminary_network()
789  reset_system_settings()  reset_system_settings()
790  {  {
791   # force load of de kbdkeys   # force load of de kbdkeys
792   loadkeys -q de   [ -x /usr/bin/loadkeys ] && loadkeys -q de
793     [ -x /sbin/loadkmap ] && loadkmap < /usr/share/busybox/keymaps/de.kmap
794   rc_echo   rc_echo
795   rc_echo -en ${COLRED}   rc_echo -en "${COLRED}"
796   rc_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!'
797   rc_echo -e ${COLDEFAULT}   rc_echo -e "${COLDEFAULT}"
798   rc_echo "*** Do you really want to continue ?"   rc_echo '--- Do you really want to continue ?'
799   rc_echo -n "*** Enter 'yes' to continue, anything else to abort: "   rc_echo -n '--- Enter 'yes' to continue, anything else to abort: '
800   read kbinsert   read kbinsert
801   if [[ ${kbinsert} = yes ]]   if [[ ${kbinsert} = yes ]]
802   then   then
803   rc_echo -en ${COLRED}   rc_echo -en "${COLRED}"
804   rc_echo -n "*** OK, you really want it ... killing all settings: "   rc_echo -n '--- OK, you really want it ... killing all settings: '
805   for i in 3 2 1 now   for i in 3 2 1 now
806   do   do
807   rc_echo -n " ${i}"   rc_echo -n " ${i}"
808   sleep 1   sleep 1
809   done   done
810   rc_echo -e ${COLDEFAULT}   rc_echo -e "${COLDEFAULT}"
811    
812   ## reset all settings:   ## reset all settings:
813   rm -rf ${SETTINGSPATH}/*   rm -rf ${SETTINGSPATH}
814   rm -f /etc/alxconfig-ng/serial   rm -f /etc/alxconfig-ng/serial
815   rm -rf /etc/alxconfig-ng/state   rm -rf /etc/alxconfig-ng/state
816     local i
817     for i in xserver netcard knoppix mouse
818     do
819     [[ -f /etc/conf.d/hwsetup/${i} ]] && rm /etc/conf.d/hwsetup/${i}
820     done
821    
822   # clear all printers & net-shares   # clear all printers & net-shares
823   :> /etc/printcap   :> /etc/printcap
824    
825   # remove lprng   # remove lprng
826   rc-config del lprng &> /dev/null   rc-config del lprng &> /dev/null
827     rc-config del nmbd &> /dev/null
828    
829   # remove all user settings   # remove all user settings
830   [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}   [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}
831     install -o ${ALX_UNPRIV_USER} -g ${ALX_UNPRIV_GROUP} -d ${ALX_UNPRIV_HOME}
832    
833   # remove all ica-sessions   # remove all ica-sessions
834   find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs rm   find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs --no-run-if-empty rm
835    
836   # remove all old nics and modules configs   # remove all old nics and modules configs
837   find /etc/conf.d -type f -name 'net.*' | xargs rm   find /etc/conf.d -type f -name 'net.*' | xargs --no-run-if-empty rm
838   find /etc/modprobe.d -type f -name 'net.*' | xargs rm   find /etc/modprobe.d -type f -name 'net.*' | xargs --no-run-if-empty rm
839    
840   # restore default networking   # restore default networking
841   cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0   cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0
842     local CONFIG="/etc/hostname"
843     clearconfig
844     addconfig "${ALX_DEFAULT_HOSTNAME}"
845    
846   rc_echo "I am done now, press [Enter] to reboot system ..."   rc_echo -n "I am done now, press [Enter] to reboot system ..."
847   else   else
848   rc_echo "Aborted, press [Enter] to reboot system ..."   rc_echo -n "Aborted, press [Enter] to reboot system ..."
849   fi   fi
850   read   read
851   reboot   sync
852     mount -oremount,ro /
853     reboot -f
854  }  }
855    
856  onboot_interface_list()  onboot_interface_list()

Legend:
Removed from v.2479  
changed lines
  Added in v.3466