87 |
|
|
88 |
get_system_serial() |
get_system_serial() |
89 |
{ |
{ |
90 |
local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE |
# never declare ALX_IFACE as a local variable! ->fixme! |
91 |
|
local CUR_IP CUR_MAC CUR_MTIME CONFIG |
92 |
|
|
93 |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
94 |
then |
then |
122 |
# nice serial output |
# nice serial output |
123 |
$CURS_UP |
$CURS_UP |
124 |
$SET_WCOL |
$SET_WCOL |
125 |
echo "[ SN: ${ALX_SERIAL} ]" |
rc_echo "[ SN: ${ALX_SERIAL} ]" |
126 |
|
|
127 |
if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}" |
if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}" |
128 |
then |
then |
130 |
else |
else |
131 |
# abort on non valid serial |
# abort on non valid serial |
132 |
ALX_STATE="invalid serial" |
ALX_STATE="invalid serial" |
133 |
echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state |
CONFIG="/etc/alxconfig-ng/state/state" |
134 |
|
clearconfig |
135 |
|
addconfig "ALX_STATE=\"${ALX_STATE}\"" |
136 |
show_invalid_serial_msg |
show_invalid_serial_msg |
137 |
exit 1 |
exit 1 |
138 |
fi |
fi |
139 |
|
|
140 |
else |
else |
141 |
# run hardware detection |
# run hardware detection |
142 |
echo |
rc_echo |
143 |
if [[ ${ALX_FORCED_RECHECK} = true ]] |
if [[ ${ALX_FORCED_RECHECK} = true ]] |
144 |
then |
then |
145 |
rc_mecho "Hardware autodetection forced by system-administrator" |
rc_mecho "Hardware autodetection forced by system-administrator" |
158 |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
159 |
|
|
160 |
# update the hostname on the system for sure |
# update the hostname on the system for sure |
161 |
echo "${HOSTNAME}" > /etc/hostname |
CONFIG="/etc/hostname" |
162 |
|
clearconfig |
163 |
|
addconfig "${HOSTNAME}" |
164 |
|
|
165 |
# start preliminary networking (dhcp) |
# start preliminary networking (dhcp) |
166 |
preliminary_network start |
preliminary_network start |
173 |
exit 1 |
exit 1 |
174 |
fi |
fi |
175 |
|
|
|
|
|
176 |
CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp') |
CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp') |
177 |
CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11) |
CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11) |
178 |
CUR_MTIME=$(date +%s) |
CUR_MTIME=$(date +%s) |
188 |
# nice serial output |
# nice serial output |
189 |
$CURS_UP |
$CURS_UP |
190 |
$SET_WCOL |
$SET_WCOL |
191 |
echo "[ SN: ${ALX_SERIAL} ]" |
rc_echo "[ SN: ${ALX_SERIAL} ]" |
192 |
|
|
193 |
if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}" |
if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}" |
194 |
then |
then |
196 |
else |
else |
197 |
# abort on non valid serial |
# abort on non valid serial |
198 |
ALX_STATE="invalid serial" |
ALX_STATE="invalid serial" |
199 |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
CONFIG="/etc/alxconfig-ng/state/state" |
200 |
|
clearconfig |
201 |
|
addconfig "ALX_STATE=\"${ALX_STATE}\"" |
202 |
show_invalid_serial_msg |
show_invalid_serial_msg |
203 |
exit 1 |
exit 1 |
204 |
fi |
fi |
205 |
|
|
206 |
# write current state to temp file |
# write current state to temp file |
207 |
echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state |
CONFIG="/etc/alxconfig-ng/state/state" |
208 |
|
clearconfig |
209 |
|
addconfig "ALX_STATE=\"${ALX_STATE}\"" |
210 |
[ -f /hardware-auto-detection ] && rm /hardware-auto-detection |
[ -f /hardware-auto-detection ] && rm /hardware-auto-detection |
211 |
|
|
212 |
# now export ALX_FORCED_RECHECK=true |
# now export ALX_FORCED_RECHECK=true |
226 |
# nice serial output |
# nice serial output |
227 |
$CURS_UP |
$CURS_UP |
228 |
$SET_WCOL |
$SET_WCOL |
229 |
echo "[ SN: ${ALX_SERIAL} ]" |
rc_echo "[ SN: ${ALX_SERIAL} ]" |
230 |
|
|
231 |
# set ALX_STATE to ok so everybody knows that everything was ok |
# set ALX_STATE to ok so everybody knows that everything was ok |
232 |
ALX_STATE=ok |
ALX_STATE=ok |
233 |
|
|
234 |
echo "ALX_SERIAL=\"${ALX_SERIAL}\"" > /etc/alxconfig-ng/serial |
CONFIG="/etc/alxconfig-ng/serial" |
235 |
echo "ALX_REG_DATE=\"${CUR_MTIME}\"" >> /etc/alxconfig-ng/serial |
clearconfig |
236 |
|
addconfig "ALX_SERIAL=\"${ALX_SERIAL}\"" |
237 |
|
addconfig "ALX_REG_DATE=\"${CUR_MTIME}\"" |
238 |
|
|
239 |
evaluate_retval |
evaluate_retval |
240 |
else |
else |
248 |
# nice serial output |
# nice serial output |
249 |
$CURS_UP |
$CURS_UP |
250 |
$SET_WCOL |
$SET_WCOL |
251 |
echo -e "[ SN: ${COLRED}None, 0${COLDEFAULT} ]" |
rc_echo -e "[ SN: ${COLRED}None, 0${COLDEFAULT} ]" |
252 |
fi |
fi |
253 |
fi |
fi |
254 |
|
|
255 |
# write current state to temp file |
# write current state to temp file |
256 |
echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state |
CONFIG="/etc/alxconfig-ng/state/state" |
257 |
echo "ALX_IFACE=\"${ALX_IFACE}\"" >> /etc/alxconfig-ng/state/state |
clearconfig |
258 |
|
addconfig "ALX_STATE=\"${ALX_STATE}\"" |
259 |
|
addconfig "ALX_IFACE=\"${ALX_IFACE}\"" |
260 |
} |
} |
261 |
|
|
262 |
|
|
290 |
source /etc/conf.d/hwsetup/knoppix |
source /etc/conf.d/hwsetup/knoppix |
291 |
source /etc/conf.d/hwsetup/mouse |
source /etc/conf.d/hwsetup/mouse |
292 |
|
|
293 |
echo |
rc_echo |
294 |
rc_mecho "Importing detected settings to database" |
rc_mecho "Importing detected settings to database" |
295 |
|
|
296 |
# network |
# network |
463 |
source /etc/conf.d/hwsetup/knoppix |
source /etc/conf.d/hwsetup/knoppix |
464 |
source /etc/conf.d/hwsetup/mouse |
source /etc/conf.d/hwsetup/mouse |
465 |
|
|
466 |
echo |
rc_echo |
467 |
rc_mecho "Updating detected settings in database" |
rc_mecho "Updating detected settings in database" |
468 |
|
|
469 |
# network |
# network |
560 |
# get setting from hwsetup |
# get setting from hwsetup |
561 |
source /etc/conf.d/hwsetup/knoppix |
source /etc/conf.d/hwsetup/knoppix |
562 |
|
|
563 |
echo |
rc_echo |
564 |
rc_mecho "Importing detected settings to local system" |
rc_mecho "Importing detected settings to local system" |
565 |
|
|
566 |
if [[ ${ALX_CONFD_NETWORKING} = false ]] |
if [[ ${ALX_CONFD_NETWORKING} = false ]] |
581 |
# regenerate modprobe.conf |
# regenerate modprobe.conf |
582 |
[ -x $(which modules-update) ] && modules-update || rc_echo "modules-update not found!" |
[ -x $(which modules-update) ] && modules-update || rc_echo "modules-update not found!" |
583 |
evaluate_retval |
evaluate_retval |
584 |
|
|
585 |
|
# restore default networking if hardware-detection was called by administrator and iface config is empty |
586 |
|
if [[ ${ALX_FORCED_RECHECK} = true ]] && [ ! -s /etc/conf.d/net.${ALX_IFACE} ] && [ -f ${SETTINGSPATH}/confd-networking ] |
587 |
|
then |
588 |
|
rc_echo " Network config is empty, using default skeleton" |
589 |
|
cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.${ALX_IFACE} |
590 |
|
fi |
591 |
fi |
fi |
592 |
|
|
593 |
# set system state to 'already configured' |
# set system state to 'already configured' |
789 |
;; |
;; |
790 |
|
|
791 |
*) |
*) |
792 |
echo "Usage: preliminary_network {start|stop}" |
rc_echo "Usage: preliminary_network {start|stop}" |
793 |
;; |
;; |
794 |
esac |
esac |
795 |
} |
} |
821 |
rm -rf ${SETTINGSPATH} |
rm -rf ${SETTINGSPATH} |
822 |
rm -f /etc/alxconfig-ng/serial |
rm -f /etc/alxconfig-ng/serial |
823 |
rm -rf /etc/alxconfig-ng/state |
rm -rf /etc/alxconfig-ng/state |
824 |
|
local i |
825 |
|
for i in xserver netcard knoppix mouse |
826 |
|
do |
827 |
|
[[ -f /etc/conf.d/hwsetup/${i} ]] && rm /etc/conf.d/hwsetup/${i} |
828 |
|
done |
829 |
|
|
830 |
# clear all printers & net-shares |
# clear all printers & net-shares |
831 |
:> /etc/printcap |
:> /etc/printcap |
847 |
|
|
848 |
# restore default networking |
# restore default networking |
849 |
cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0 |
cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0 |
850 |
echo "${ALX_DEFAULT_HOSTNAME}" > /etc/hostname |
local CONFIG="/etc/hostname" |
851 |
|
clearconfig |
852 |
|
addconfig "${ALX_DEFAULT_HOSTNAME}" |
853 |
|
|
854 |
rc_echo -n "I am done now, press [Enter] to reboot system ..." |
rc_echo -n "I am done now, press [Enter] to reboot system ..." |
855 |
else |
else |
856 |
rc_echo -n "Aborted, press [Enter] to reboot system ..." |
rc_echo -n "Aborted, press [Enter] to reboot system ..." |
857 |
fi |
fi |
858 |
read |
read |
859 |
reboot |
sync |
860 |
|
mount -oremount,ro / |
861 |
|
reboot -f |
862 |
} |
} |
863 |
|
|
864 |
onboot_interface_list() |
onboot_interface_list() |
985 |
;; |
;; |
986 |
|
|
987 |
*) |
*) |
988 |
echo "Usage: $0 {start|stop} ..." |
rc_echo "Usage: $0 {start|stop} ..." |
989 |
;; |
;; |
990 |
esac |
esac |