From 20d6468a28678a376edbef7b2d67391dff2aaae2 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 12 Aug 2019 11:43:27 -0500 Subject: New config for l4e1, lap3 --- recipes-core/multitech/config/chat_wrapper | 129 +++++++++++++++++++++ recipes-core/multitech/config/chat_wrapper.default | 12 ++ recipes-core/multitech/config/ppp/peers/gsm | 2 +- recipes-core/multitech/config/ppp/peers/gsm_chat | 29 ++++- recipes-core/multitech/config/ppp/peers/l4e1 | 2 +- recipes-core/multitech/config/ppp/peers/l4e1_chat | 24 +++- recipes-core/multitech/config/ppp/peers/l4n1 | 2 +- .../multitech/config/ppp/peers/l4n1_chat_non_vz | 37 ++++-- recipes-core/multitech/config/ppp/peers/lap3 | 2 +- recipes-core/multitech/config/ppp/peers/lap3_chat | 26 ++++- recipes-core/multitech/config/ppp/peers/leu1 | 2 +- recipes-core/multitech/config/ppp/peers/leu1_chat | 23 +++- recipes-core/multitech/config/ppp/peers/lna3 | 2 +- .../multitech/config/ppp/peers/lna3_chat_non_vz | 36 ++++-- recipes-core/multitech/config/ppp/peers/lsp3 | 2 +- recipes-core/multitech/config/ppp/peers/lsp3_chat | 24 +++- recipes-core/multitech/config_2.2.bb | 83 ------------- recipes-core/multitech/config_2.3.bb | 91 +++++++++++++++ 18 files changed, 409 insertions(+), 119 deletions(-) create mode 100755 recipes-core/multitech/config/chat_wrapper create mode 100644 recipes-core/multitech/config/chat_wrapper.default delete mode 100644 recipes-core/multitech/config_2.2.bb create mode 100644 recipes-core/multitech/config_2.3.bb (limited to 'recipes-core') diff --git a/recipes-core/multitech/config/chat_wrapper b/recipes-core/multitech/config/chat_wrapper new file mode 100755 index 0000000..9db3188 --- /dev/null +++ b/recipes-core/multitech/config/chat_wrapper @@ -0,0 +1,129 @@ +#!/bin/bash + +# Rules for chat scripts +# No comments allowed at the end of AT+CGDCONT in chat script +# The last AT+CGDCONT= must use the same context as the dialer. +# If desired, The AT+CGDCONT may be prefixed by #MT[[:space:]]+ +# Example: +#MT AT+CGDCONT="IPV6","data","192.168.2.1",0,1,"EXTRA" +# +# If you do not use a comment, the entire AT+CGDCONT command +# must be surrounded by apostrophes. This command will be executed +# twice, once in the chat wrapper, and a 2nd time in the chat +# itself. +# +# The space after "#MT" may be any number including tabs. +# If #MT AT+CGDCONT= is found, only the last one is chosen. +# Any uncommented AT+CGDCONT= is then ignored. +# If there are not #MT AT+CGDCONT= lines, then any line without +# a comment chararacter before AT+CGDONT= is accepted, but only the +# last one in the file. + +NAME=chat_wrapper +CONFIG=/etc/default/${NAME} +function finish +{ + ${LOG} "Launch:" "$@" + exec "$@" + # NOTREACHED +} + +[[ -f $CONFIG ]] || exit 1 + +. ${CONFIG} + +: ${REGWAITTIME:=300} +: ${FINALWAIT:=5} + +: ${LOG:="/usr/bin/logger -t ${NAME} -p daemon.notice"} + +${LOG} Timeout is $REGWAITTIME, execute "$@" +((i=$#)) +chatscript="${!i}" +${LOG} Parsing chat script "$chatscript" + +# CONTEXT is last context string in chat script +CONTEXT=$(egrep "^#MT[[:space:]]+(AT\+CGDCONT=.*)" ${chatscript} | tail -1) +if ((${#CONTEXT} == 0)) ; then + CONTEXT=$(egrep "^[^#]+AT\+CGDCONT=" ${chatscript} | tail -1) + [[ $CONTEXT =~ \'(AT\+CGDCONT=([0-9]+)[^$\']+) ]] +else + [[ $CONTEXT =~ (AT\+CGDCONT=([0-9]+).*)$ ]] +fi + +# CONTEXTNUM is the context number that is configured in the dialer. +CONTEXT="${BASH_REMATCH[1]}" +if ((${#CONTEXT} == 0)) ; then + ${LOG} No context specifiction in the chat script + finish "$@" + # NOTREACHED +fi +((CONTEXTNUM=${BASH_REMATCH[2]})) + + +${LOG} "Using Context ${CONTEXTNUM} based on chat script: ${CONTEXT}" + +# At this point if there is no context number, we can skip everything else. + +# Get Modem's context settings +MCONTEXT=$(/usr/bin/radio-cmd -t10 'AT+CGDCONT?' 2>&1 | tr -d '\r') +[[ $MCONTEXT =~ \+CGDCONT:[[:space:]]+${CONTEXTNUM},\"([^\"]*)\",\"([^\"]*)\",\"([^\"]*)\",([0-9]+),([0-9]+)([^$'\n']*) ]] + +MPDP="${BASH_REMATCH[1]}" +MAPN="${BASH_REMATCH[2]}" +MADDR="${BASH_REMATCH[3]}" +MDCOMP="${BASH_REMATCH[4]}" +MHCOMP="${BASH_REMATCH[5]}" +MFULLBOAT="${BASH_REMATCH[6]}" + +[[ $CONTEXT =~ AT\+CGDCONT=${CONTEXTNUM},\"([^\"]*)\",\"([^\"]*)\"(,\"([^\"]*)\"(,([0-9]+)(,([0-9]+)(,[^\']*))*)*)* ]] +PDP="${BASH_REMATCH[1]}" +APN="${BASH_REMATCH[2]}" +ADDR="${BASH_REMATCH[4]}" # Optional +DCOMP="${BASH_REMATCH[6]}" # Optional +HCOMP="${BASH_REMATCH[8]}" # Optional +FULLBOAT="${BASH_REMATCH[9]}" # Optional + +if ((${#DCOMP} == 0)) ; then + ((DCOMP=0)) # Default +fi +if ((${#HCOMP} == 0)) ; then + ((HCOMP=0)) # Default +fi + +# Only update context on a mismatch between chat and modem. +if [[ $MPDP != $PDP ]] || [[ $MAPN != $APN ]] || \ + [[ $MADDR != $ADDR ]] || ((MDCOMP != DCOMP)) || \ + ((MHCOMP != HCOMP)) || \ + [[ $MFULLBOAT != $FULLBOAT ]] ; then + ${LOG} "Modem context $MPDP,$MAPN,$MADDR,$MDCOMP,$HCOMP does not match chat script" + ${LOG} "$MCONTEXT" + ${LOG} "Dropping registration with carrier to set context" + # Need to deregister + /usr/bin/radio-cmd -t10 'AT+COPS=2' + /usr/bin/radio-cmd -t10 "AT+CGDCONT=${CONTEXTNUM},\"${PDP}\",\"${APN}\",\"${ADDR}\",$DCOMP,${HCOMP}${FULLBOAT}" + /usr/bin/radio-cmd -t10 'AT+COPS=0' + ${LOG} "New context is set. Wait up to $REGWAITTIME seconds to register" + # Wait for registration + uptime=$(cat /proc/uptime) + [[ $uptime =~ ^([^\.]*) ]] + t0=${BASH_REMATCH[1]} + while ! [[ $(/usr/bin/radio-query --netreg) =~ ^REGISTERED$ ]] ; do + sleep 5 + uptime=$(cat /proc/uptime) + [[ $uptime =~ ^([^\.]*) ]] + t1=${BASH_REMATCH[1]} + if ((t1-t0 > REGWAITTIME)) ; then + ${LOG} "$((t1-t0)) seconds has expired" + fi + done + uptime=$(cat /proc/uptime) + [[ $uptime =~ ^([^\.]*) ]] + t1=${BASH_REMATCH[1]} + ${LOG} "Re-registered in $((t1-t0)) seconds -- wait 5 more seconds" + sleep $FINALWAIT +else + ${LOG} "Context $CONTEXTNUM matches and nothing to do." +fi +finish "$@" +# NOTREACHED diff --git a/recipes-core/multitech/config/chat_wrapper.default b/recipes-core/multitech/config/chat_wrapper.default new file mode 100644 index 0000000..941c008 --- /dev/null +++ b/recipes-core/multitech/config/chat_wrapper.default @@ -0,0 +1,12 @@ +# The maximum time to wait for registration +# when changing the modem context parameters. +# This is ignored if the context is +# already set correctly in the modem. +REGWAITTIME=300 + +# The time to wait after registration +# when setting the context +# before attempting a PPP connection. +# This is ignored if the context is +# already set correctly in the modem. +FINALWAIT=5 diff --git a/recipes-core/multitech/config/ppp/peers/gsm b/recipes-core/multitech/config/ppp/peers/gsm index d23957e..c456764 100644 --- a/recipes-core/multitech/config/ppp/peers/gsm +++ b/recipes-core/multitech/config/ppp/peers/gsm @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/gsm_chat' +connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/gsm_chat' diff --git a/recipes-core/multitech/config/ppp/peers/gsm_chat b/recipes-core/multitech/config/ppp/peers/gsm_chat index 5e18e05..a92c938 100644 --- a/recipes-core/multitech/config/ppp/peers/gsm_chat +++ b/recipes-core/multitech/config/ppp/peers/gsm_chat @@ -12,11 +12,32 @@ OK 'ATZ' OK 'AT+CSQ' # ---------------------------------- # Set the APN for your provider here +# Note that a comment starting with +# #MT AT+CGDCONT= +# will be interpretted by +# /usr/libexec/chat_wrapper +# as the intended context +# setting. Make the context number +# (after the =) match the +# dialer number context. +# If the context changes, chat_wrapper +# handles disconnecting the modem +# from the network during the update, +# which is required +# by some modem firmware. +# The chat script will be executed +# after the chat_wrapper script +# re-registers the modem. +# The context will only be set if the +# modem settings do not match the +# settings here. +# Lines starting with # MT are ignored. # ---------------------------------- -#OK 'AT+CGDCONT=1,"IP","proxy"' -#OK 'AT+CGDCONT=1,"IP","ISP.CINGULAR"' -#OK 'AT+CGDCONT=1,"IP","internet2.voicestream.com"' -OK 'AT+CGDCONT=1,"IP","internet"' +# MT AT+CGDCONT=1,"IP","proxy" +# MT AT+CGDCONT=1,"IP","ISP.CINGULAR" +# MT AT+CGDCONT=1,"IP","internet2.voicestream.com" +#MT AT+CGDCONT=1,"IP","internet" +OK 'AT+CGDCONT?' SAY "Dialing...\n" #OK 'ATD*99#' OK 'ATD*99***1#' diff --git a/recipes-core/multitech/config/ppp/peers/l4e1 b/recipes-core/multitech/config/ppp/peers/l4e1 index d6359cd..2996e6e 100644 --- a/recipes-core/multitech/config/ppp/peers/l4e1 +++ b/recipes-core/multitech/config/ppp/peers/l4e1 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/l4e1_chat' +connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/l4e1_chat' diff --git a/recipes-core/multitech/config/ppp/peers/l4e1_chat b/recipes-core/multitech/config/ppp/peers/l4e1_chat index 3a297ed..6b6be44 100644 --- a/recipes-core/multitech/config/ppp/peers/l4e1_chat +++ b/recipes-core/multitech/config/ppp/peers/l4e1_chat @@ -12,10 +12,28 @@ OK 'ATZ' OK 'AT+CSQ' # ---------------------------------- # Set the APN for your provider here +# Note that a comment starting with +# #MT AT+CGDCONT= +# will be interpretted by +# /usr/libexec/chat_wrapper +# as the intended context +# setting. Make the context number +# (after the =) match the +# dialer number context. +# If the context changes, chat_wrapper +# handles disconnecting the modem +# from the network during the update, +# which is required +# by some modem firmware. +# The chat script will be executed +# after the chat_wrapper script +# re-registers the modem. +# The context will only be set if the +# modem settings do not match the +# settings here. +# Lines starting with # MT are ignored. # ---------------------------------- -OK 'AT+COPS=2' -OK 'AT+CGDCONT=1,"IP","internet"' -OK 'AT+COPS=0' +#MT AT+CGDCONT=1,"IP","internet" OK 'AT+CGDCONT?' SAY "Dialing...\n" OK 'ATD*99***1#' diff --git a/recipes-core/multitech/config/ppp/peers/l4n1 b/recipes-core/multitech/config/ppp/peers/l4n1 index c0b4beb..2e0b501 100644 --- a/recipes-core/multitech/config/ppp/peers/l4n1 +++ b/recipes-core/multitech/config/ppp/peers/l4n1 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/l4n1_chat' +connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/l4n1_chat' diff --git a/recipes-core/multitech/config/ppp/peers/l4n1_chat_non_vz b/recipes-core/multitech/config/ppp/peers/l4n1_chat_non_vz index ea5907e..64a05be 100644 --- a/recipes-core/multitech/config/ppp/peers/l4n1_chat_non_vz +++ b/recipes-core/multitech/config/ppp/peers/l4n1_chat_non_vz @@ -31,15 +31,34 @@ ABORT 'BUSY' '' 'AT' OK 'ATZ' OK 'AT+CSQ' -#------------------------------------------- -# Set the non-Verizon APN on the next line -#------------------------------------------- -#OK 'AT+CGDCONT=3,"IP","proxy"' -#OK 'AT+CGDCONT=3,"IP","ISP.CINGULAR"' -#OK 'AT+CGDCONT=3,"IP","internet2.voicestream.com"' -OK 'AT+COPS=2' -OK 'AT+CGDCONT=3,"IP","phone"' -OK 'AT+COPS=0' +# ---------------------------------- +# Set the APN for your provider here +# Note that a comment starting with +# #MT AT+CGDCONT= +# will be interpretted by +# /usr/libexec/chat_wrapper +# as the intended context +# setting. Make the context number +# (after the =) match the +# dialer number context. +# If the context changes, chat_wrapper +# handles disconnecting the modem +# from the network during the update, +# which is required +# by some modem firmware. +# The chat script will be executed +# after the chat_wrapper script +# re-registers the modem. +# The context will only be set if the +# modem settings do not match the +# settings here. +# Lines starting with # MT are ignored. +# ---------------------------------- +# MT AT+CGDCONT=3,"IP","proxy" +# MT AT+CGDCONT=3,"IP","ISP.CINGULAR" +# MT AT+CGDCONT=3,"IP","internet2.voicestream.com" +#MT AT+CGDCONT=3,"IP","phone" +OK 'AT+CGDCONT?' SAY "Dialing...\n" OK 'ATD*99***3#' SAY "Waiting for CONNECT...\n" diff --git a/recipes-core/multitech/config/ppp/peers/lap3 b/recipes-core/multitech/config/ppp/peers/lap3 index bac08a1..9b56aae 100644 --- a/recipes-core/multitech/config/ppp/peers/lap3 +++ b/recipes-core/multitech/config/ppp/peers/lap3 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lap3_chat' +connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lap3_chat' diff --git a/recipes-core/multitech/config/ppp/peers/lap3_chat b/recipes-core/multitech/config/ppp/peers/lap3_chat index bc5ebcf..92a5e54 100644 --- a/recipes-core/multitech/config/ppp/peers/lap3_chat +++ b/recipes-core/multitech/config/ppp/peers/lap3_chat @@ -1,4 +1,4 @@ -SAY "LSP3 chat\n" +SAY "LAP3 chat\n" ECHO OFF ABORT 'NO DIAL TONE' ABORT 'NO DIALTONE' @@ -10,6 +10,30 @@ ABORT 'BUSY' '' 'AT' OK 'ATZ' OK 'AT+CSQ' +# ---------------------------------- +# Set the APN for your provider here +# Note that a comment starting with +# #MT AT+CGDCONT= +# will be interpretted by +# /usr/libexec/chat_wrapper +# as the intended context +# setting. Make the context number +# (after the =) match the +# dialer number context. +# If the context changes, chat_wrapper +# handles disconnecting the modem +# from the network during the update, +# which is required +# by some modem firmware. +# The chat script will be executed +# after the chat_wrapper script +# re-registers the modem. +# The context will only be set if the +# modem settings do not match the +# settings here. +# Lines starting with # MT are ignored. +# ---------------------------------- +#MT AT+CGDCONT=1,"IP","internet" OK 'AT+CGDCONT?' SAY "Dialing...\n" OK 'ATD*99***1#' diff --git a/recipes-core/multitech/config/ppp/peers/leu1 b/recipes-core/multitech/config/ppp/peers/leu1 index 993b33a..2e247b3 100644 --- a/recipes-core/multitech/config/ppp/peers/leu1 +++ b/recipes-core/multitech/config/ppp/peers/leu1 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/leu1_chat' +connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/leu1_chat' diff --git a/recipes-core/multitech/config/ppp/peers/leu1_chat b/recipes-core/multitech/config/ppp/peers/leu1_chat index 23faf0e..817f75d 100644 --- a/recipes-core/multitech/config/ppp/peers/leu1_chat +++ b/recipes-core/multitech/config/ppp/peers/leu1_chat @@ -12,8 +12,29 @@ OK 'ATZ' OK 'AT+CSQ' # ---------------------------------- # Set the APN for your provider here +# Note that a comment starting with +# #MT AT+CGDCONT= +# will be interpretted by +# /usr/libexec/chat_wrapper +# as the intended context +# setting. Make the context number +# (after the =) match the +# dialer number context. +# If the context changes, chat_wrapper +# handles disconnecting the modem +# from the network during the update, +# which is required +# by some modem firmware. +# The chat script will be executed +# after the chat_wrapper script +# re-registers the modem. +# The context will only be set if the +# modem settings do not match the +# settings here. +# Lines starting with # MT are ignored. # ---------------------------------- -OK 'AT+CGDCONT=1,"IP","internet"' +#MT AT+CGDCONT=1,"IP","internet" +OK 'AT+CGDCONT?' SAY "Dialing...\n" OK 'ATD*99***1#' SAY "Waiting for CONNECT...\n" diff --git a/recipes-core/multitech/config/ppp/peers/lna3 b/recipes-core/multitech/config/ppp/peers/lna3 index bd84569..022e4fc 100644 --- a/recipes-core/multitech/config/ppp/peers/lna3 +++ b/recipes-core/multitech/config/ppp/peers/lna3 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lna3_chat' +connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lna3_chat' diff --git a/recipes-core/multitech/config/ppp/peers/lna3_chat_non_vz b/recipes-core/multitech/config/ppp/peers/lna3_chat_non_vz index 033efde..33fd377 100644 --- a/recipes-core/multitech/config/ppp/peers/lna3_chat_non_vz +++ b/recipes-core/multitech/config/ppp/peers/lna3_chat_non_vz @@ -31,14 +31,34 @@ ABORT 'BUSY' '' 'AT' OK 'ATZ' OK 'AT+CSQ' -#------------------------------------------- -# Set the non-Verizon APN on the next line -#------------------------------------------- -#OK 'AT+CGDCONT=3,"IP","proxy"' -#OK 'AT+CGDCONT=3,"IP","ISP.CINGULAR"' -#OK 'AT+CGDCONT=3,"IP","internet2.voicestream.com"' -OK 'AT+COPS=2' -OK 'AT+CGDCONT=3,"IP","phone"' +# ---------------------------------- +# Set the APN for your provider here +# Note that a comment starting with +# #MT AT+CGDCONT= +# will be interpretted by +# /usr/libexec/chat_wrapper +# as the intended context +# setting. Make the context number +# (after the =) match the +# dialer number context. +# If the context changes, chat_wrapper +# handles disconnecting the modem +# from the network during the update, +# which is required +# by some modem firmware. +# The chat script will be executed +# after the chat_wrapper script +# re-registers the modem. +# The context will only be set if the +# modem settings do not match the +# settings here. +# Lines starting with # MT are ignored. +# ---------------------------------- +# MT AT+CGDCONT=3,"IP","proxy" +# MT AT+CGDCONT=3,"IP","ISP.CINGULAR" +# MT AT+CGDCONT=3,"IP","internet2.voicestream.com" +#MT AT+CGDCONT=3,"IP","phone" +OK 'AT+CGDCONT?' OK 'AT+COPS=0' SAY "Dialing...\n" OK 'ATD*99***3#' diff --git a/recipes-core/multitech/config/ppp/peers/lsp3 b/recipes-core/multitech/config/ppp/peers/lsp3 index 072477b..4a3da2f 100644 --- a/recipes-core/multitech/config/ppp/peers/lsp3 +++ b/recipes-core/multitech/config/ppp/peers/lsp3 @@ -8,4 +8,4 @@ ipcp-restart 10 noauth crtscts novj -connect '/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lsp3_chat' +connect '/usr/libexec/chat_wrapper /usr/sbin/chat -v -t 90 -f /etc/ppp/peers/lsp3_chat' diff --git a/recipes-core/multitech/config/ppp/peers/lsp3_chat b/recipes-core/multitech/config/ppp/peers/lsp3_chat index 347c3b8..529a260 100644 --- a/recipes-core/multitech/config/ppp/peers/lsp3_chat +++ b/recipes-core/multitech/config/ppp/peers/lsp3_chat @@ -12,10 +12,28 @@ OK 'ATZ' OK 'AT+CSQ' # ---------------------------------- # Set the APN for your provider here +# Note that a comment starting with +# #MT AT+CGDCONT= +# will be interpretted by +# /usr/libexec/chat_wrapper +# as the intended context +# setting. Make the context number +# (after the =) match the +# dialer number context. +# If the context changes, chat_wrapper +# handles disconnecting the modem +# from the network during the update, +# which is required +# by some modem firmware. +# The chat script will be executed +# after the chat_wrapper script +# re-registers the modem. +# The context will only be set if the +# modem settings do not match the +# settings here. +# Lines starting with # MT are ignored. # ---------------------------------- -OK 'AT+COPS=2' -OK 'AT+CGDCONT=1,"IP","internet"' -OK 'AT+COPS=0' +#MT AT+CGDCONT=1,"IP","internet" OK 'AT+CGDCONT?' SAY "Dialing...\n" OK 'ATD*99***2#' diff --git a/recipes-core/multitech/config_2.2.bb b/recipes-core/multitech/config_2.2.bb deleted file mode 100644 index da51cc9..0000000 --- a/recipes-core/multitech/config_2.2.bb +++ /dev/null @@ -1,83 +0,0 @@ -DESCRIPTION = "Provides default system config files and /var/config fs" -SECTION = "base" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" -PACKAGE_ARCH = "all" -PR = "r1" -PACKAGES =+ "${PN}-mths" -inherit update-rc.d - -INITSCRIPT_NAME = "config" -INITSCRIPT_PARAMS = "start 31 S ." - -FILESEXTRAPATHS_prepend := "${THISDIR}/config:" -FILESEXTRAPATHS_prepend_${PN} := "${THISDIR}/mths_config:" - -SRC_URI = "\ - file://network \ - file://ppp \ - file://config.init \ - file://config-mths \ -" - -RDEPENDS_${PN}-mths += "${PN}" - -CONFFILES_${PN} += "${sysconfdir}/defaults.tar.gz" -CONFIGFILES = "network/interfaces ppp" - -CONFIGFILES_MTHS = "config-mths" - -fakeroot do_install () { - cd ${WORKDIR} - - # default config files - rm -f defaults.tar.gz - chown root:root -R ${CONFIGFILES} - tar czf defaults.tar.gz ${CONFIGFILES} - install -d ${D}${sysconfdir} - install -m 0644 ${WORKDIR}/defaults.tar.gz ${D}${sysconfdir}/defaults.tar.gz - - # save root password for resetting to defaults - echo -n '${ROOT_PASSWORD_HASH}' > ${D}${sysconfdir}/default_pass - chmod 400 ${D}${sysconfdir}/default_pass - - # init script - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/config.init ${D}${sysconfdir}/init.d/config - - # mths adjustments - tar -C ${CONFIGFILES_MTHS} -czf defaults-mths.tar.gz . - install -m 0644 ${WORKDIR}/defaults-mths.tar.gz ${D}${sysconfdir}/defaults-mths.tar.gz -} - -FILES_${PN} = "${sysconfdir}/defaults.tar.gz ${sysconfdir}/default_pass" -FILES_${PN} += "${sysconfdir}/init.d/config" - -FILES_${PN}-mths = "${sysconfdir}/defaults-mths.tar.gz" - -# Create the hotspot version of defaults.tar.gz -pkg_postinst_${PN}-mths() { - X=$D/tmp/mths - mkdir -p $X - export X - ( - - set -x - if tar -tf $D${sysconfdir}/defaults.tar.gz | grep dnsmasq ; then - : - else - tb=$X/tarball # Tarball directory - mkdir $tb - tar -C $tb -xf $D/etc/defaults.tar.gz - tar -C $tb -xf $D/etc/defaults-mths.tar.gz - if ! grep '^auto wifi1' $tb/network/interfaces ; then - cat $tb/network/interfaces $tb/network/interfaces.mths >$tb/network/interfaces.new - mv $tb/network/interfaces $tb/network/interfaces.old - mv $tb/network/interfaces.new $tb/network/interfaces - fi - tar -C $tb -cf $D/etc/defaults.tar.gz . - fi - ) >$X/postinsttrace.txt 2>&1 - # Comment out the final line for a trace. - rm -rf $X -} diff --git a/recipes-core/multitech/config_2.3.bb b/recipes-core/multitech/config_2.3.bb new file mode 100644 index 0000000..816aab2 --- /dev/null +++ b/recipes-core/multitech/config_2.3.bb @@ -0,0 +1,91 @@ +DESCRIPTION = "Provides default system config files and /var/config fs" +SECTION = "base" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" +PACKAGE_ARCH = "all" +PR = "r1" +PACKAGES =+ "${PN}-mths" +inherit update-rc.d + +INITSCRIPT_NAME = "config" +INITSCRIPT_PARAMS = "start 31 S ." + +FILESEXTRAPATHS_prepend := "${THISDIR}/config:" +FILESEXTRAPATHS_prepend_${PN} := "${THISDIR}/mths_config:" + +SRC_URI = "\ + file://network \ + file://ppp \ + file://config.init \ + file://config-mths \ + file://chat_wrapper \ + file://chat_wrapper.default \ +" + +RDEPENDS_${PN}-mths += "${PN}" + +CONFFILES_${PN} += "${sysconfdir}/defaults.tar.gz" +CONFIGFILES = "network/interfaces ppp" + +CONFIGFILES_MTHS = "config-mths" + +fakeroot do_install () { + cd ${WORKDIR} + + # default config files + rm -f defaults.tar.gz + chown root:root -R ${CONFIGFILES} + tar czf defaults.tar.gz ${CONFIGFILES} + install -d ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/defaults.tar.gz ${D}${sysconfdir}/defaults.tar.gz + + # save root password for resetting to defaults + echo -n '${ROOT_PASSWORD_HASH}' > ${D}${sysconfdir}/default_pass + chmod 400 ${D}${sysconfdir}/default_pass + + # init script + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/config.init ${D}${sysconfdir}/init.d/config + + # mths adjustments + tar -C ${CONFIGFILES_MTHS} -czf defaults-mths.tar.gz . + install -m 0644 ${WORKDIR}/defaults-mths.tar.gz ${D}${sysconfdir}/defaults-mths.tar.gz + + install -d ${D}${sysconfdir}/defaults + install -d ${D}${libexecdir}/ppp + install -m 0755 ${WORKDIR}/chat_wrapper ${D}${libexecdir}/ppp/chat_wrapper + install -m 0644 ${WORKDIR}/chat_wrapper.default ${D}${sysconfdir}/defaults + +} + +FILES_${PN} = "${sysconfdir}/defaults.tar.gz ${sysconfdir}/default_pass" +FILES_${PN} += "${sysconfdir}/init.d/config" + +FILES_${PN}-mths = "${sysconfdir}/defaults-mths.tar.gz" + +# Create the hotspot version of defaults.tar.gz +pkg_postinst_${PN}-mths() { + X=$D/tmp/mths + mkdir -p $X + export X + ( + + set -x + if tar -tf $D${sysconfdir}/defaults.tar.gz | grep dnsmasq ; then + : + else + tb=$X/tarball # Tarball directory + mkdir $tb + tar -C $tb -xf $D/etc/defaults.tar.gz + tar -C $tb -xf $D/etc/defaults-mths.tar.gz + if ! grep '^auto wifi1' $tb/network/interfaces ; then + cat $tb/network/interfaces $tb/network/interfaces.mths >$tb/network/interfaces.new + mv $tb/network/interfaces $tb/network/interfaces.old + mv $tb/network/interfaces.new $tb/network/interfaces + fi + tar -C $tb -cf $D/etc/defaults.tar.gz . + fi + ) >$X/postinsttrace.txt 2>&1 + # Comment out the final line for a trace. + rm -rf $X +} -- cgit v1.2.3