GithubHelp home page GithubHelp logo

tavinus / opkg-upgrade Goto Github PK

View Code? Open in Web Editor NEW
315.0 315.0 61.0 98 KB

List and install OpenWRT / LEDE opkg upgradable packages

Shell 100.00%
ash bash bash-script lede openwrt openwrt-package opkg

opkg-upgrade's People

Contributors

lareq avatar nmasse-itix avatar tavinus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opkg-upgrade's Issues

Incorrect statement when no packages need updates

When there's no package to be updated, the software should say so, instead of this:

Simple OPKG Updater v0.3.0

Done | Updating package lists
Error when trying list upgradable packages. Permissions?

Optional removal of *-opkg from /etc/config after upgrade

Nice to have:

A) Ask the user if he/she would like to remove all default configuration files that opkg places in /etc/config ( /etc/config/*-opkg )
B) If so, delete them

Another approach would be to move them out to another directory

Love this script - cron+email

Masterful work. I wonder if it is possible to have it email you when there are updates. For example say I set a cron job to check for updates every Friday. Instead of sshing into the box and running your script manually, it could email me the list of update-able packages.

Wish List - 2019/2020/2021/2022/2023

Already Implemented

v0.3.2 :

  • Sort package list by package names
  • Ignore opkg warnings
    • opkg list-upgradable may print something like "Multiple packages (libpthread and libpthread) providing same name marked HOLD or PREFER. Using latest." within the list. This used to cause an error because it would be parsed as a package name.
    • It was kind of rare though. I THINK it only happens on TRUNK/BETA versions that are very old.
  • Use awk + printf to print an ASCII table of the updates (prettier)

v0.3.4 :

  • Load info from /etc/openwrt_release when available
  • Add more router info on email report (from openwrt_release)
  • Detect if the system is a DISTRIB_RELEASE='SNAPSHOT' and show warning about upgrading those
  • New/prettier HTML email (new font type, sizes and info table)

Pending

  • Colorized output (must be optional)
  • Implement Self-Update parameter/functionality (to upgrade from github master)
  • Implement tests (travis-ci maybe?)
  • Option to select / choose which updates to apply
    • Very cool idea but adds a lot on complexity / parsing, may be postponed
    • Already have a numbered list that can be used
  • Wiki Content
    • Troubleshooting
      • The squashfs "problem" (read only, uses new space)
      • The SNAPSHOT "problem" (why those should not be upgraded)
    • Install / Download
    • Self-Update
    • Basic Usage / Examples
    • Emailing reports (ssmtp and others)
    • Dealing with config file conflicts
  • Tools to compare / diff config files conflicts
    • Should try to detect /etc/config/*-opkg files (or get from installer message)
    • Use diff or git diff to offer comparison (if available)
    • File Operations for conf files
      • Remove
      • Move
      • Edit / Merge

tav

Integrating opkg-upgrade in .profile - how to use background checking for new packages

Hello,
I have integrated opkg-upgrade in .profile, means I get this when starting a shell-session as root:

thomas@eddie:~$ sudo su -


BusyBox v1.33.2 (2022-04-16 12:59:34 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 21.02.3, r16554-1d4dea6d4f
 -----------------------------------------------------

My current WAN IP is: xxx.xxx.xxx.xxx

Software status report:
--> No upgrades available.

This is implemented with the following coding in .profile:

YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
echo "Software status report:"
opkg-upgrade -u \
&& echo -e "${YELLOW}--> Upgrades are available.${NC}\n----> List available upgrades: opkg-upgrade -l\n----> Upgrade packages: opkg-upgrade\n" \
|| echo -e "${GREEN}--> No upgrades available.${NC}\n"

The downside of this implementation is that I have to wait several seconds until the command prompt is ready.

Question:
Can I check for new packages in the background (regularely) and then fetch the results only w/o waiting for command opkg-upgrade -u to return data?

THX

[Contribution] How to run from Luci

Here is an easier way to run this command without the need to use Putty and SSH.

0- install the shell command according to the tutorial and take not of where it was saved (you can lookup for it using WinSCP)
1- install (luci-app-commands)
2- refresh your browser page (F5)
3- on LUCI top menu find ( System \ Custom Commands
4 - select Configuration tab
5- click add button
6- insert a relevant description (example: opkg-upgrade)
7- on command field insert the path to the script (with the command name and taking care of the extension existence or not) [example: /usr/sbin/opkg-upgrade -f] Note: add -f or --force to make it do the upgrade without the need to add the Custom arguments yourself, optionally you can check the Custom arguments if you want this to be more flexible and allows you to adjust the execution to your actual need.

I hope this help

Blacklist packages

Got a donation asking to be able to blacklist packages.
Seems like a nice addition to avoid problematic packages that should not be upgraded.

Need more research on some things:

  • Can we blacklist from opkg itself?
  • Can we blacklist on repository configuration?
  • Does opkg has any kind of pinning?
  • Should we save the information of blacklisted packages on a file? Where?
  • Should we just have a parameter to ignore packages on the fly?

Script ends with cancelled by user

I tried your script but it does not ask me if I want to install updates it just say's cancelled by user, Any guidence would be appreciated.

This is the command I used:
curl -k -sSL https://raw.githubusercontent.com/tavinus/opkg-upgrade/master/opkg-upgrade.sh | sh

A little bit about my install and my router:

LEDE/OpenWRT
Model | TP-Link TL-WDR4300 v1
Firmware Version | LEDE Reboot 17.01.2 r3435-65eec8bd5f / LuCI lede-17.01 branch (git-17.152.82987-7f6fc16)
Kernel Version | 4.4.71

Running your script using curl:

root@LEDE:~# curl -k -sSL  https://raw.githubusercontent.com/tavinus/opkg-upgrade/master/opkg-upgrade.sh | sh

Simple OPKG Updater v0.2.3

Done | Updating package lists
Done | Getting upgradable packages list

Packages available for upgrade: 13

luci-lib-ip - git-17.152.82987-7f6fc16-1 - git-17.194.52964-580f012-1
luci-theme-bootstrap - git-17.152.82987-7f6fc16-1 - git-17.194.52964-580f012-1
dnsmasq - 2.77-1 - 2.77-2
luci-app-firewall - git-17.152.82987-7f6fc16-1 - git-17.194.52964-580f012-1
odhcp6c - 2017-01-30-c13b6a05-1 - 2017-01-30-c13b6a05-2
dropbear - 2017.75-1 - 2017.75-2
luci-proto-ppp - git-17.152.82987-7f6fc16-1 - git-17.194.52964-580f012-1
luci-mod-admin-full - git-17.152.82987-7f6fc16-1 - git-17.194.52964-580f012-1
luci-base - git-17.152.82987-7f6fc16-1 - git-17.194.52964-580f012-1
luci-proto-ipv6 - git-17.152.82987-7f6fc16-1 - git-17.194.52964-580f012-1
luci-lib-nixio - git-17.152.82987-7f6fc16-1 - git-17.194.52964-580f012-1
luci-lib-jsonc - git-17.152.82987-7f6fc16-1 - git-17.194.52964-580f012-1
luci - git-17.152.82987-7f6fc16-1 - git-17.194.52964-580f012-1


Cancelled by user!

root@LEDE:~#

Just thought I would let you know your script still works OpenWRT 19.07.0 first release candidate

Just thought I would let you know your script still works OpenWRT 19.07.0 first release candidate

# curl -k -sSL https://raw.githubusercontent.com/tavinus/opkg-upgrade/master/opkg-upgrade.sh -o ./opkg-upgrade.sh && chmod +x ./opkg-upgrade.sh && ./opkg-upgrade.sh

Simple OPKG Updater v0.3.5

Done | Updating package lists
Done | Getting upgradable packages list

Packages available for upgrade: 18

+-----+----------------------+----------------------------+----------------------------+
|   # | Package              | Current                    | Update                     |
+-----+----------------------+----------------------------+----------------------------+
|   1 | luci                 | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|   2 | luci-app-firewall    | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|   3 | luci-app-opkg        | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|   4 | luci-app-travelmate  | git-19.310.44720-c2be304-1 | git-19.312.54336-a987e21-1 |
|   5 | luci-base            | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|   6 | luci-compat          | git-19.310.44720-c2be304-1 | git-19.312.54336-a987e21-1 |
|   7 | luci-lib-ip          | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|   8 | luci-lib-jsonc       | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|   9 | luci-lib-nixio       | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|  10 | luci-mod-admin-full  | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|  11 | luci-mod-network     | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|  12 | luci-mod-status      | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|  13 | luci-mod-system      | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|  14 | luci-proto-ipv6      | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|  15 | luci-proto-ppp       | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|  16 | luci-proto-relay     | git-19.310.44720-c2be304-1 | git-19.312.54336-a987e21-1 |
|  17 | luci-theme-bootstrap | git-19.309.76540-c0e73d3-1 | git-19.312.54336-a987e21-1 |
|  18 | rpcd-mod-luci        | 20191103                   | 20191108                   |
+-----+----------------------+----------------------------+----------------------------+

Proceed with upgrade? (Y/y to proceed) y

.... | Upgrading packages`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.