ti_tftp by BTC
unknown
plain_text
10 months ago
1.9 kB
8
Indexable
Never
#!/bin/sh echo "Running ti_tftp $@" >> /var/tmp/bwlog ti_tftp_orig $@ set -- $(getopt "F:vf:s:t:i:w:p:b:m:cda" "$@") for o; do case "$o" in -w) dir=$2 shift ;; -f) filename=$2 shift ;; --) shift; break ;; *) shift;; esac done dir=${dir-$(pwd)} parent=`cat /proc/$PPID/comm` #this is silently truncated to 15, FYI. #This fixes the problem where the URL isnt parsed properly. #filename get lastpiece a/b/c = c filename=`echo $filename | sed 's|.*/||'` #This patch is redundant, and was fixed by the patch above (get lastpiece), but leaving here just in case. if [ -f '/nvram/fcsufoverride' ]; then echo "Config filename override patch activated." >> /var/tmp/bwlog filename=`cat /nvram/fcsufoverride` fi #for some reason, pacm is initialized by pcd on some modems.. #pacm_mta_contro) case $parent in dmg_provisionin) echo "Testing if we should replace CM config" >> /var/tmp/bwlog if [ -f '/nvram/1/config.cm' ]; then echo "Replacing downloaded config $filename with user-defined config" >> /var/tmp/bwlog cp '/nvram/1/config.cm' $dir/$filename fi ln -s $dir/$filename /var/tmp/running.config ;; pcd) echo "Testing if we should replace MTA config" >> /var/tmp/bwlog if [ -f '/nvram/1/config.mta' ]; then echo "Replacing downloaded MTA config $filename with user-defined MTA config" >> /var/tmp/bwlog cp '/nvram/1/config.mta' $dir/$filename fi ln -s $dir/$filename /var/tmp/runningmta.config ;; pacm_mta_contro) echo "Testing if we should replace MTA config" >> /var/tmp/bwlog if [ -f '/nvram/1/config.mta' ]; then echo "Replacing downloaded MTA config $filename with user-defined MTA config" >> /var/tmp/bwlog cp '/nvram/1/config.mta' $dir/$filename fi ln -s $dir/$filename /var/tmp/runningmta.config ;; *) echo "Unknown process $parent invoked ti_tftp, doing nothing." >> /var/tmp/bwlog ;; esac shift