FIXME unfinished stuff.

mirror-opkg-repositories
#!/usr/bin/awk -f
##==============================================================================
## OpenWrt repository mirror script.
##------------------------------------------------------------------------------
## TODO:
## - Delete packages not mentioned in the Packages file.
## - Make local target path absolute.
##==============================================================================
BEGIN {
        Dir["reboot_core"]      = "downloads.lede-project.org/releases/17.01.4/targets/x86/legacy/packages"
        Dir["reboot_base"]      = "downloads.lede-project.org/releases/17.01.4/packages/i386_pentium/base"
        Dir["reboot_luci"]      = "downloads.lede-project.org/releases/17.01.4/packages/i386_pentium/luci"
        Dir["reboot_packages"]  = "downloads.lede-project.org/releases/17.01.4/packages/i386_pentium/packages"
        Dir["reboot_routing"]   = "downloads.lede-project.org/releases/17.01.4/packages/i386_pentium/routing"
        Dir["reboot_telephony"] = "downloads.lede-project.org/releases/17.01.4/packages/i386_pentium/telephony"
        for(Component in Dir) {
                DestDir = Dir[Component]
                BaseURL = "http://"DestDir
                ##
                ## make sure Destdir exists
                ##
                system("test -d "DestDir" || mkdir -p "DestDir)
                ##
                ## get Packages.gz, save it and unpack to Packages on the fly
                ##
                GetPackages = "cd "DestDir" && wget -cO- "BaseURL"/Packages.gz | tee Packages.gz | gzip -dc | tee Packages"
                GetIPKs     = "cd "DestDir" && wget -ci-"
                ##
                ## @@@todo@@@ add error checking here
                ##
                while( GetPackages | getline ) {
                        if ( /^Filename: / )
                                print BaseURL"/"$2 | GetIPKs
                }
                close( GetPackages )
                close( GetIPKs )
        }
}

:?: This script uses wget options busybox's wget does not provide.

:!: If you have room to run your mirror on your OpenWrt box, you have the room to install the nonbusybox version of wget too. Right?

:?: lftp is available and may be the better tool to mirror stuff. Or even rsync.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2018/01/16 20:21
  • by yeti