Magellan Linux

Diff of /trunk/mage/usr/lib/mage/mage4.functions.sh

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

revision 966 by niro, Fri Feb 19 19:59:22 2010 UTC revision 1273 by niro, Wed Apr 27 09:45:07 2011 UTC
# Line 23  unpack_packages() Line 23  unpack_packages()
23   local pkgtype   local pkgtype
24   local count_current   local count_current
25   local count_total   local count_total
26     local tar_opts
27    
28   # get count of total packages   # get count of total packages
29   declare -i count_current=0   declare -i count_current=0
# Line 54  unpack_packages() Line 55  unpack_packages()
55   continue   continue
56   fi   fi
57    
58     # busybox?
59     if need_busybox_support tar
60     then
61     tar_opts="xjf"
62     else
63     tar_opts="xjmf"
64     fi
65    
66   echo -e " ${COLBLUE}***${COLDEFAULT} unpacking (${count_current}/${count_total}): ${pkg} ... "   echo -e " ${COLBLUE}***${COLDEFAULT} unpacking (${count_current}/${count_total}): ${pkg} ... "
67   tar xjmf ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}"   tar ${tar_opts} ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}"
68   done   done
69    
70   # add a crlf for a better view   # add a crlf for a better view
# Line 339  install_blockdevices() Line 348  install_blockdevices()
348   local pkgname="$1"   local pkgname="$1"
349   local pathto   local pathto
350   local posix   local posix
351     local user
352     local group
353   local IFS   local IFS
354    
355   # sanity checks; abort if not given   # sanity checks; abort if not given
# Line 352  install_blockdevices() Line 363  install_blockdevices()
363   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
364   IFS=§   IFS=§
365    
366   while read pathto posix   while read pathto posix major minor user group
367   do   do
368   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
369   [[ ${VERBOSE} = on ]] && echo -e "\t>>> PIPE: ${MROOT}${pathto}"   [[ ${VERBOSE} = on ]] && echo -e "\t>>> PIPE: ${MROOT}${pathto}"
370    
371   mkfifo -m "${posix}" "${MROOT}$pathto"   mknod -m "${posix}" "${MROOT}${pathto}"
372     # make it optional atm !!
373     if [[ ! -z ${user} ]] && [[ ! -z ${group} ]]
374     then
375     chown "${user}:${group}" "${MROOT}${pathto}" b "${major}" "${minor}"
376     fi
377   done < ${BUILDDIR}/${pkgname}/.pipes   done < ${BUILDDIR}/${pkgname}/.pipes
378    
379   # very important: unsetting the '§' fieldseperator   # very important: unsetting the '§' fieldseperator
# Line 376  install_characterdevices() Line 392  install_characterdevices()
392   local posix   local posix
393   local major   local major
394   local minor   local minor
395     local user
396     local group
397   local IFS   local IFS
398    
399   # sanity checks; abort if not given   # sanity checks; abort if not given
# Line 389  install_characterdevices() Line 407  install_characterdevices()
407   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
408   IFS=§   IFS=§
409    
410   while read pathto posix major minor   while read pathto posix major minor user group
411   do   do
412   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
413   [[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}"   [[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}"
414    
415   mknod -m ${posix} "${MROOT}${pathto}" c ${major} ${minor}   mknod -m ${posix} "${MROOT}${pathto}" b "${major}" "${minor}"
416    
417     # make it optional atm !!
418     if [[ ! -z ${user} ]] && [[ ! -z ${group} ]]
419     then
420     chown "${user}:${group}" "${MROOT}${pathto}"
421     fi
422   done < ${BUILDDIR}/${pkgname}/.char   done < ${BUILDDIR}/${pkgname}/.char
423    
424   # very important: unsetting the '§' fieldseperator   # very important: unsetting the '§' fieldseperator
425   IFS=$'\n'   IFS=$'\n'
426  }  }
427    
428    ###################################################
429    # function install_fifos                          #
430    # install_fifos $PKGNAME                    #
431    ###################################################
432    install_fifos()
433    {
434     local pkgname="$1"
435     local pathto
436     local posix
437     local user
438     local group
439     local IFS
440    
441     # sanity checks; abort if not given
442     [ -z "${pkgname}" ] && die "install_fifos() \$pkgname not given."
443    
444     # check needed global vars
445     [ -z "${BUILDDIR}" ] && die "install_fifos() \$BUILDDIR not set."
446    
447     # make it optional atm !!
448     #[ ! -f ${BUILDDIR}/${pkgname}/.fifo ] && die "install_fifos() .fifo not found"
449     [ ! -f ${BUILDDIR}/${pkgname}/.fifo ] && return
450    
451     # sets fieldseperator to "§" instead of " "
452     IFS=§
453    
454     while read pathto posix user group
455     do
456     [ -z "${pathto}" ] && continue
457     [[ ${VERBOSE} = on ]] && echo -e "\t>>> FIFO: ${MROOT}${pathto}"
458    
459     mkfifo -m "${posix}" "${MROOT}${pathto}"
460     chown "${user}:${group}" "${MROOT}${pathto}"
461     done < ${BUILDDIR}/${pkgname}/.fifo
462    
463     # very important: unsetting the '§' fieldseperator
464     IFS=$'\n'
465    }
466    
467    
468  ###################################################  ###################################################
469  # function build_doinstall                        #  # function build_doinstall                        #
470  # build_doinstall $PKGNAME                  #  # build_doinstall $PKGNAME                  #
471  # NOTE: this is an wrapper do install packages    #  # NOTE: this is an wrapper to install packages    #
472  ###################################################  ###################################################
473  build_doinstall()  build_doinstall()
474  {  {
# Line 428  build_doinstall() Line 491  build_doinstall()
491   install_symlinks ${pkgname} || die "install symlinks ${pkgname}"   install_symlinks ${pkgname} || die "install symlinks ${pkgname}"
492   install_blockdevices ${pkgname} || die "install blockdevices ${pkgname}"   install_blockdevices ${pkgname} || die "install blockdevices ${pkgname}"
493   install_characterdevices ${pkgname} || die "install chardevices ${pkgname}"   install_characterdevices ${pkgname} || die "install chardevices ${pkgname}"
494     install_fifos ${pkgname} || die "install fifos ${pkgname}"
495  }  }
496    
497    
# Line 489  install_database_entry() Line 553  install_database_entry()
553    
554   # create fake file descriptors   # create fake file descriptors
555   # used by virtual and source packages   # used by virtual and source packages
556   for i in .dirs .symlinks .files .pipes .char   for i in .dirs .symlinks .files .pipes .char .fifo
557   do   do
558   touch ${dbrecorddir}/${i}   touch ${dbrecorddir}/${i}
559   done   done
# Line 507  install_database_entry() Line 571  install_database_entry()
571    
572   # normal packages needs these files   # normal packages needs these files
573   local i   local i
574   for i in .char .dirs .files .pipes .symlinks   for i in .char .dirs .files .pipes .symlinks .fifo
575   do   do
576   install -m 0644 ${BUILDDIR}/${pkgname}/${i} \   # make .fifo optional atm
577   ${dbrecorddir}/${i}   if [[ -f ${BUILDDIR}/${pkgname}/${i} ]]
578     then
579     install -m 0644 ${BUILDDIR}/${pkgname}/${i} ${dbrecorddir}/${i}
580     fi
581   done   done
582   ;;   ;;
583   esac   esac
# Line 785  remove_files() Line 852  remove_files()
852   done   done
853    
854   # sanity checks; abort if not given   # sanity checks; abort if not given
855   [ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given."   [ -z "${pcat}" ] && die "remove_files() \$pcat not given."
856   [ -z "${pname}" ] && die "remove_symlinks() \$pname not given."   [ -z "${pname}" ] && die "remove_files() \$pname not given."
857   [ -z "${pver}" ] && die "remove_symlinks() \$pver not given."   [ -z "${pver}" ] && die "remove_files() \$pver not given."
858   [ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given."   [ -z "${pbuild}" ] && die "remove_files() \$pbuild not given."
859   pfull="${pcat}/${pname}-${pver}-${pbuild}"   pfull="${pcat}/${pname}-${pver}-${pbuild}"
860    
861   # check needed global vars   # check needed global vars
# Line 879  remove_blockdevices() Line 946  remove_blockdevices()
946  {  {
947   local pathto   local pathto
948   local posix   local posix
949     local user
950     local group
951   local IFS   local IFS
952   local pcat   local pcat
953   local pname   local pname
# Line 902  remove_blockdevices() Line 971  remove_blockdevices()
971   done   done
972    
973   # sanity checks; abort if not given   # sanity checks; abort if not given
974   [ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given."   [ -z "${pcat}" ] && die "remove_blockdevices() \$pcat not given."
975   [ -z "${pname}" ] && die "remove_symlinks() \$pname not given."   [ -z "${pname}" ] && die "remove_blockdevices() \$pname not given."
976   [ -z "${pver}" ] && die "remove_symlinks() \$pver not given."   [ -z "${pver}" ] && die "remove_blockdevices() \$pver not given."
977   [ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given."   [ -z "${pbuild}" ] && die "remove_blockdevices() \$pbuild not given."
978   pfull="${pcat}/${pname}-${pver}-${pbuild}"   pfull="${pcat}/${pname}-${pver}-${pbuild}"
979    
980   # check needed global vars   # check needed global vars
# Line 916  remove_blockdevices() Line 985  remove_blockdevices()
985   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
986   IFS=§   IFS=§
987    
988   while read pathto posix   while read pathto posix user group
989   do   do
990   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
991    
# Line 937  remove_characterdevices() Line 1006  remove_characterdevices()
1006  {  {
1007   local pathto   local pathto
1008   local posix   local posix
1009     local user
1010     local group
1011   local IFS   local IFS
1012   local pcat   local pcat
1013   local pname   local pname
# Line 960  remove_characterdevices() Line 1031  remove_characterdevices()
1031   done   done
1032    
1033   # sanity checks; abort if not given   # sanity checks; abort if not given
1034   [ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given."   [ -z "${pcat}" ] && die "remove_characterdevices() \$pcat not given."
1035   [ -z "${pname}" ] && die "remove_symlinks() \$pname not given."   [ -z "${pname}" ] && die "remove_characterdevices() \$pname not given."
1036   [ -z "${pver}" ] && die "remove_symlinks() \$pver not given."   [ -z "${pver}" ] && die "remove_characterdevices() \$pver not given."
1037   [ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given."   [ -z "${pbuild}" ] && die "remove_characterdevices() \$pbuild not given."
1038   pfull="${pcat}/${pname}-${pver}-${pbuild}"   pfull="${pcat}/${pname}-${pver}-${pbuild}"
1039    
1040   # check needed global vars   # check needed global vars
# Line 974  remove_characterdevices() Line 1045  remove_characterdevices()
1045   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
1046   IFS=§   IFS=§
1047    
1048   while read pathto posix   while read pathto posix user group
1049   do   do
1050   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
1051    
# Line 988  remove_characterdevices() Line 1059  remove_characterdevices()
1059    
1060    
1061  ###################################################  ###################################################
1062    # function remove_fifos                           #
1063    # remove_fifos $PKGNAME                     #
1064    ###################################################
1065    remove_fifos()
1066    {
1067     local pathto
1068     local posix
1069     local user
1070     local group
1071     local IFS
1072     local pcat
1073     local pname
1074     local pver
1075     local pbuild
1076     local i
1077     local pfull
1078    
1079     IFS=$'\n'
1080    
1081     # very basic getops
1082     for i in $*
1083     do
1084     case $1 in
1085     --pcat|-c) shift; pcat="$1" ;;
1086     --pname|-n) shift; pname="$1" ;;
1087     --pver|-v) shift; pver="$1" ;;
1088     --pbuild|-b) shift; pbuild="$1" ;;
1089     esac
1090     shift
1091     done
1092    
1093     # sanity checks; abort if not given
1094     [ -z "${pcat}" ] && die "remove_fifos() \$pcat not given."
1095     [ -z "${pname}" ] && die "remove_fifos() \$pname not given."
1096     [ -z "${pver}" ] && die "remove_fifos() \$pver not given."
1097     [ -z "${pbuild}" ] && die "remove_fifos() \$pbuild not given."
1098     pfull="${pcat}/${pname}-${pver}-${pbuild}"
1099    
1100     # check needed global vars
1101     [ -z "${BUILDDIR}" ] && die "remove_fifos() \$BUILDDIR not set."
1102    
1103     # make it optional atm !!
1104     #[ ! -f ${MROOT}${INSTALLDB}/${pfull}/.fifo ] && die "remove_fifos() .fifo not found"
1105     [ ! -f ${MROOT}${INSTALLDB}/${pfull}/.fifo ] && return
1106    
1107     # sets fieldseperator to "§" instead of " "
1108     IFS=§
1109    
1110     while read pathto posix user group
1111     do
1112     [ -z "${pathto}" ] && continue
1113    
1114     [[ ${VERBOSE} = on ]] && echo -e "\t<<< FIFO: ${MROOT}${pathto}"
1115     rm "${MROOT}${pathto}"
1116     done < ${MROOT}${INSTALLDB}/${pfull}/.fifo
1117    
1118     # very important: unsetting the '§' fieldseperator
1119     IFS=$'\n'
1120    }
1121    
1122    
1123    ###################################################
1124  # function remove_direcories                      #  # function remove_direcories                      #
1125  # remove_direcories $PKGNAME                #  # remove_direcories $PKGNAME                #
1126  ###################################################  ###################################################
# Line 1018  remove_directories() Line 1151  remove_directories()
1151   done   done
1152    
1153   # sanity checks; abort if not given   # sanity checks; abort if not given
1154   [ -z "${pcat}" ] && die "remove_symlinks() \$pcat not given."   [ -z "${pcat}" ] && die "remove_directories() \$pcat not given."
1155   [ -z "${pname}" ] && die "remove_symlinks() \$pname not given."   [ -z "${pname}" ] && die "remove_directories() \$pname not given."
1156   [ -z "${pver}" ] && die "remove_symlinks() \$pver not given."   [ -z "${pver}" ] && die "remove_directories() \$pver not given."
1157   [ -z "${pbuild}" ] && die "remove_symlinks() \$pbuild not given."   [ -z "${pbuild}" ] && die "remove_directories() \$pbuild not given."
1158   pfull="${pcat}/${pname}-${pver}-${pbuild}"   pfull="${pcat}/${pname}-${pver}-${pbuild}"
1159    
1160   # check needed global vars   # check needed global vars
# Line 1075  remove_directories() Line 1208  remove_directories()
1208  ###################################################  ###################################################
1209  # function build_douninstall                      #  # function build_douninstall                      #
1210  # build_douninstall $PKGNAME                #  # build_douninstall $PKGNAME                #
1211  # NOTE: this is an wrapper do remove packages     #  # NOTE: this is an wrapper to remove packages     #
1212  ###################################################  ###################################################
1213  build_douninstall()  build_douninstall()
1214  {  {
# Line 1109  build_douninstall() Line 1242  build_douninstall()
1242   # !! we use § as field seperator !!   # !! we use § as field seperator !!
1243   # doing so prevent us to get errors by filenames with spaces   # doing so prevent us to get errors by filenames with spaces
1244    
1245   for i in symlinks files blockdevices characterdevices directories   for i in symlinks files blockdevices characterdevices directories fifos
1246   do   do
1247   remove_${i} \   remove_${i} \
1248   --pcat "${pcat}" \   --pcat "${pcat}" \
# Line 1131  fetch_packages() Line 1264  fetch_packages()
1264   local opt   local opt
1265   local count_current   local count_current
1266   local count_total   local count_total
1267     local wget_opts
1268    
1269   [ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your ${MAGERC}."   [ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your ${MAGERC}."
1270    
1271     # filter wget command if busybox was found
1272     wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"
1273    
1274   # get count of total packages   # get count of total packages
1275   declare -i count_current=0   declare -i count_current=0
1276   declare -i count_total=0   declare -i count_total=0
# Line 1179  fetch_packages() Line 1316  fetch_packages()
1316   echo -e " fetching (${count_current}/${count_total}): ${pkg} ... "   echo -e " fetching (${count_current}/${count_total}): ${pkg} ... "
1317   [[ ${VERBOSE} = off ]] && opt="--quiet"   [[ ${VERBOSE} = off ]] && opt="--quiet"
1318   wget \   wget \
1319   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
1320   --directory-prefix=${PKGDIR} \   --directory-prefix=${PKGDIR} \
1321   ${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg}   ${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg}
1322   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 1232  syncmage() Line 1366  syncmage()
1366  syncmage_tarball()  syncmage_tarball()
1367  {  {
1368   local latest_tarball   local latest_tarball
1369     local latest_md5
1370   local temp="$(mktemp -d)"   local temp="$(mktemp -d)"
1371   local mirr mymirr   local mirr mymirr
1372     local opt
1373     local tar_opts
1374    
1375     # try to get the md5 marked as latest on the server
1376     latest_md5="mage-latest.md5"
1377    
1378   # try to get the tarball marked as latest on the server   # try to get the tarball marked as latest on the server
1379   latest_tarball="mage-latest.tar.bz2"   latest_tarball="mage-latest.tar.bz2"
# Line 1244  syncmage_tarball() Line 1384  syncmage_tarball()
1384   mymirr="${mirr%/*}"   mymirr="${mirr%/*}"
1385    
1386   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1387   echo "fetching latest tarball from ${mymirr} ..."   echo "fetching latest md5 from ${mymirr} ..."
1388     [[ ${VERBOSE} = off ]] && opt="--quiet"
1389     wget \
1390     ${WGET_FETCH_OPTIONS} \
1391     --directory-prefix=${temp} \
1392     ${opt} ${mymirr}/rsync/tarballs/${latest_md5}
1393    
1394     echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1395     echo "fetching latest tarball from ${mymirr} ..."
1396   wget \   wget \
1397   --passive-ftp \   ${WGET_FETCH_OPTIONS} \
  --tries 3 \  
  --continue \  
  --progress bar \  
1398   --directory-prefix=${temp} \   --directory-prefix=${temp} \
1399   ${mymirr}/rsync/tarballs/${latest_tarball}   ${opt} ${mymirr}/rsync/tarballs/${latest_tarball}
1400   if [[ $? = 0 ]]   if [[ $? = 0 ]]
1401   then   then
1402   break   break
# Line 1263  syncmage_tarball() Line 1407  syncmage_tarball()
1407    
1408   if [[ -f ${temp}/${latest_tarball} ]]   if [[ -f ${temp}/${latest_tarball} ]]
1409   then   then
1410     # check md5
1411     if [[ ! -f ${temp}/${latest_md5} ]]
1412     then
1413     die "md5 is missing ... aborting"
1414     else
1415     echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1416     echo -n "checking md5sum... "
1417     ( cd ${temp}; md5sum -c ${latest_md5} ) || die "md5 for ${latest_tarball} failed"
1418     fi
1419    
1420   if [[ -d ${MAGEDIR} ]]   if [[ -d ${MAGEDIR} ]]
1421   then   then
1422   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
# Line 1270  syncmage_tarball() Line 1424  syncmage_tarball()
1424   rm -rf ${MAGEDIR}   rm -rf ${MAGEDIR}
1425   fi   fi
1426    
1427     if need_busybox_support tar
1428     then
1429     tar_opts="xjf"
1430     else
1431     tar_opts="xjmf"
1432     fi
1433    
1434   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1435   echo "updating mage-tree from tarball ..."   echo "updating mage-tree from tarball ..."
1436   # unpack in dirname of MAGEDIR, as the tarball has already the mage   # unpack in dirname of MAGEDIR, as the tarball has already the mage
1437   tar xjmf ${temp}/${latest_tarball} -C ${MAGEDIR%/*} || die "Unpacking tarball"   tar ${tar_opts} ${temp}/${latest_tarball} -C ${MAGEDIR%/*} || die "Unpacking tarball"
1438    
1439   if [[ -d ${temp} ]]   if [[ -d ${temp} ]]
1440   then   then
1441   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1442   echo "clenaing temp-files ..."   echo "cleaning temp-files ..."
1443   rm -rf ${temp}   rm -rf ${temp}
1444   fi   fi
1445    
# Line 1729  virtuals_add() Line 1890  virtuals_add()
1890    
1891  #deletes pakages from virtual database  #deletes pakages from virtual database
1892  #$1 virtualname; $2 pkgname  #$1 virtualname; $2 pkgname
1893  virtuals_del() {  virtuals_del()
1894    {
1895    
1896   local virtualname="$1"   local virtualname="$1"
1897   local pkgname="$2"   local pkgname="$2"
# Line 2454  md5sum_packages() Line 2616  md5sum_packages()
2616   then   then
2617   echo -ne "${COLBLUE} *** ${COLDEFAULT}"   echo -ne "${COLBLUE} *** ${COLDEFAULT}"
2618   echo -ne "checking md5sum (${count_current}/${count_total}): "   echo -ne "checking md5sum (${count_current}/${count_total}): "
2619   ( cd ${PKGDIR}; md5sum --check ${md5file}) || die "md5 for ${pkgfile} failed"   ( cd ${PKGDIR}; md5sum -c ${md5file}) || die "md5 for ${pkgfile} failed"
2620   else   else
2621   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2622   echo -e "!! no md5sum file found for ${pkgfile} :("   echo -e "!! no md5sum file found for ${pkgfile} :("
# Line 2667  mage_uninstall() Line 2829  mage_uninstall()
2829   unset -f postremove   unset -f postremove
2830  }  }
2831    
2832  show_etc_update_mesg() {  show_etc_update_mesg()
2833    {
2834   [ ${MAGE_PROTECT_COUNTER} -eq 0 ] && return 0   [ ${MAGE_PROTECT_COUNTER} -eq 0 ] && return 0
2835    
2836   echo   echo
# Line 2901  EOF Line 3064  EOF
3064   return 0   return 0
3065  }  }
3066    
3067    # need_busybox_support ${cmd}
3068    # return 0 (no error = needs busybox support) or return 1 (error = no busybox support required)
3069    need_busybox_support()
3070    {
3071     local cmd
3072     cmd="$1"
3073    
3074     if [[ -x /bin/busybox ]]
3075     then
3076     if [[ $(readlink $(which ${cmd})) = /bin/busybox ]]
3077     then
3078     # needs busybox support
3079     return 0
3080     else
3081     # no busybox
3082     return 1
3083     fi
3084     fi
3085    }
3086    
3087    # busybox_filter_wget_options ${wget_opts}
3088    busybox_filter_wget_options()
3089    {
3090     local opts="$@"
3091     local i
3092     local fixed_opts
3093    
3094     if need_busybox_support wget
3095     then
3096     for i in ${opts}
3097     do
3098     # show only the allowed ones
3099     case ${i} in
3100     -c|--continue) fixed_opts+=" -c" ;;
3101     -s|--spider) fixed_opts+=" -s" ;;
3102     -q|--quiet) fixed_opts+=" -q" ;;
3103     -O|--output-document) shift; fixed_opts+=" -O $1" ;;
3104     --header) shift; fixed_opts+=" --header $1" ;;
3105     -Y|--proxy) shift; fixed_opts+=" -Y $1" ;;
3106     -P) shift; fixed_opts+=" -P $1" ;;
3107     --no-check-certificate) fixed_opts+=" --no-check-certificate ${i}" ;;
3108     -U|--user-agent) shift; fixed_opts+=" -U ${i}" ;;
3109     # simply drop all other opts
3110     *) continue ;;
3111     esac
3112     done
3113    
3114     echo "${fixed_opts}"
3115     else
3116     echo "${opts}"
3117     fi
3118    }

Legend:
Removed from v.966  
changed lines
  Added in v.1273