Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/pxeconfig/mcore-pxeconfig.in

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

revision 2785 by niro, Wed Feb 17 10:22:09 2016 UTC revision 2800 by niro, Wed Jun 22 11:56:21 2016 UTC
# Line 53  create_pxe_config() Line 53  create_pxe_config()
53   done   done
54  }  }
55    
56  symlink_pxe_clients()  update_pxe_clients()
57  {  {
58   local i   local i
59   local ids   local ids
60   local serial   local serial
61   local config   local config
62    
63   # remove all symlinks but keep file based configs   # remove all client symlinks and files
64   find ${TFTP_DIRECTORY} -name 01-\* -type l | xargs --no-run-if-empty rm   # 01- is the prefix identifier of the pxe/tftpd server for mac adresses
65     find ${TFTP_DIRECTORY} -name 01-\* -type l -o -name 01-\* -type f | xargs --no-run-if-empty rm
66    
67   ids=$(mysqldo "select serial from client_serials where enabled='1' and location <> '';")   ids=$(mysqldo "select serial from client_serials where enabled='1' and location <> '';")
68   for serial in ${ids}   for serial in ${ids}
69   do   do
70   evaluate_table_xml client_serials "where serial='${serial}'"   evaluate_table_xml client_serials "where serial='${serial}'"
71     evaluate_table_xml client_boot "where serial='${serial}'"
72   if [[ -n ${client_serials_mac} ]]   if [[ -n ${client_serials_mac} ]]
73   then   then
74     # 01- is the prefix identifier of the pxe/tftpd server for mac adresses
75   config="${TFTP_DIRECTORY}/01-${client_serials_mac//:/-}"   config="${TFTP_DIRECTORY}/01-${client_serials_mac//:/-}"
76   # do not update if an individual config file exist   # do not symlink if an individual config is requested
77   if [[ -f ${config} ]]   if [[ -n ${client_boot_cmdline} ]] && [[ ${client_boot_cmdline} != NULL ]]
78   then   then
79   echo "A config file named '${config}' already exist"   echo "Using an individual configuration  for '${config}'"
80     sed -e "s:^\([[:space:]]append .*\):\1 ${client_boot_cmdline}:" \
81     ${TFTP_DIRECTORY}/lpxelinux-default-"${client_serials_location}" > "${config}"
82   else   else
  # 01- is the prefix identifier of the pxe/tftpd server for mac adresses  
83   ln -snf lpxelinux-default-"${client_serials_location}" "${config}"   ln -snf lpxelinux-default-"${client_serials_location}" "${config}"
84   fi   fi
85   fi   fi
# Line 84  symlink_pxe_clients() Line 88  symlink_pxe_clients()
88    
89  case $1 in  case $1 in
90   create-config) create_pxe_config ;;   create-config) create_pxe_config ;;
91   symlink-clients) symlink_pxe_clients ;;   # keep symlink-clients for compat reasons atm
92   *) echo "Unknown command, user either 'create-config' or 'symlink-clients'"; exit 1 ;;   symlink-clients|update-clients) update_pxe_clients ;;
93     *) echo "Unknown command, user either 'create-config' or 'update|symlink-clients'"; exit 1 ;;
94  esac  esac

Legend:
Removed from v.2785  
changed lines
  Added in v.2800