OpenWRT 自动更新软件包脚本

正式版固件推荐,snapshot版本不建议使用,第三方定制rom禁用!

新建一个shell脚本文件,如/root/autoupgrade.sh,加上执行权限,写入以下几行:

然后加入到计划任务中:

30 条评论

  1. 引用: Shadowsocks for OpenWRT 拾遗 - 飞羽博客

  2. Jays 回复

    po主, opkg update 升级速度缓慢的问题是怎么解决的呢?

    openwrt的官网仓库貌似被干扰的很严重

    1. cokebar 文章作者 回复

      干扰应该没有吧 应该只是单纯的慢 挂shadowsocks代理就行了

  3. aa65535 回复

    对于 trunk 版固件来说,上面的脚本会将 kmod 更新,改成这样可能更合适

    1. cokebar 文章作者 回复

      太感谢啦!我用的BB正式版,没考虑到这个问题

  4. 引用: 玩转 Shadowsocks 本博客文章合集目录 - 飞羽博客

  5. Kenny 回复

    wget -O- ‘http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest’ | awk -F\| ‘/CN\|ipv4/ { printf(“%s/%d\n”, $4, 32-log($5)/log(2)) }’ > /etc/shadowsocks/ignore.list
    把这个写成SHELL脚本怎么写呢?想加到计划任务中,定点更新。

    1. John 回复

      #!/bin/sh

      wget -O- ‘http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest’ | awk -F\| ‘/CN\|ipv4/ { printf(“%s/%d\n”, $4, 32-log($5)/log(2)) }’ > /etc/ignore.list
      done

      1. cokebar 文章作者 回复

        没有处理意外 可能会出故障

  6. alan 回复

    我用pdsnsd+ss,无法打开youtube和facebook等 ,有些可以打开,如何解决。谢谢

    1. K-Pax 回复

      我也是这个情况,怎么办啊?

      1. cokebar 文章作者 回复

        重刷稳定版OpenWRT

  7. 周先生 回复

    那个时间上怎么填写打开192.168.1.1时自动更新呢?

    1. cokebar 文章作者 回复

      crontab无法实现这个功能 你得修改luci才可能

  8. fly2016 回复

    手动执行这个脚本,出现以下错误,求助:
    root@TPA7CV2:~# /root/autoupgrade.sh
    opkg: unknown sub-command update
    usage: opkg [options…] sub-command [arguments…]
    where sub-command is one of:

    Package Manipulation:
    update Update list of available packages
    upgrade Upgrade packages
    install Install package(s)
    configure Configure unpacked package(s)
    remove Remove package(s)
    flag Flag package(s)
    =hold|noprune|user|ok|installed|unpacked (one per invocation)

    Informational Commands:
    list List available packages
    list-installed List installed packages
    list-upgradable List installed and upgradable packages
    list-changed-conffiles List user modified configuration files
    files List files belonging to
    search List package providing
    find List packages whose name or description matches
    info [pkg|regexp] Display all info for
    status [pkg|regexp] Display all status for
    download Download to current directory
    compare-versions
    compare versions using <= >= = <>
    print-architecture List installable package architectures
    depends [-A] [pkgname|pat]+
    whatdepends [-A] [pkgname|pat]+
    whatdependsrec [-A] [pkgname|pat]+
    whatrecommends[-A] [pkgname|pat]+
    whatsuggests[-A] [pkgname|pat]+
    whatprovides [-A] [pkgname|pat]+
    whatconflicts [-A] [pkgname|pat]+
    whatreplaces [-A] [pkgname|pat]+

    Options:
    -A Query all packages not just those installed
    -V[] Set verbosity level to .
    –verbosity[=] Verbosity levels:
    0 errors only
    1 normal messages (default)
    2 informative messages
    3 debug
    4 debug level 2
    -f Use as the opkg configuration file
    –conf
    –cache Use a package cache
    -d Use as the the root directory for
    –dest package installation, removal, upgrading.
    should be a defined dest name from
    the configuration file, (but can also be a
    directory name in a pinch).
    -o Use as the root directory for
    –offline-root offline installation of packages.
    –add-arch : Register architecture with given priority
    –add-dest : Register destination with given path

    Force Options:
    –force-depends Install/remove despite failed dependencies
    –force-maintainer Overwrite preexisting config files
    –force-reinstall Reinstall package(s)
    –force-overwrite Overwrite files from other package(s)
    –force-downgrade Allow opkg to downgrade packages
    –force-space Disable free space checks
    –force-postinstall Run postinstall scripts even in offline mode
    –force-remove Remove package even if prerm script fails
    –force-checksum Don’t fail on checksum mismatches
    –noaction No action — test only
    –download-only No action — download only
    –nodeps Do not follow dependencies
    –nocase Perform case insensitive pattern matching
    –size Print package size when listing available packages
    –force-removal-of-dependent-packages
    Remove package and all dependencies
    –autoremove Remove packages that were installed
    automatically to satisfy dependencies
    -t Specify tmp-dir.
    –tmp-dir Specify tmp-dir.

    regexp could be something like ‘pkgname*’ ‘*file*’ or similar
    e.g. opkg info ‘libstd*’ or opkg search ‘*libop*’ or opkg remove ‘libncur*’
    /root/autoupgrade.sh: line 2: syntax error: unexpected word (expecting “do”)

    1. fly2016 回复

      对不起,出错是因为脚本少了第一行#!/bin/sh

  9. fly2016 回复

    手动执行脚本,还是出错,救助。
    root@TPA7CV2:~# /root/autoupgrade.sh
    -ash: /root/autoupgrade.sh: not found

    1. fly2016 回复

      出错信息好象说没找到文件。用ls命令,此文件明明是在的,怎么回事?
      ls /root/autoupgrade.sh
      /root/autoupgrade.sh

    2. cokebar 文章作者 回复

      没加执行权限:
      chmod +x /root/autoupgrade.sh

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

请输入验证码 *