Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:additional-software:opkg [2021/09/27 21:10] – [Verbose opkg update] vgaetera | docs:guide-user:additional-software:opkg [2023/04/03 00:34] – [Local repository] update vgaetera | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| The '' | The '' | ||
| - | Opkg is a fork of '' | + | Opkg is a fork of '' |
| Opkg is a full package manager for the root file system, including kernel modules and drivers, while ipkg is just a way to add software to a separate directory (e.g. ''/ | Opkg is a full package manager for the root file system, including kernel modules and drivers, while ipkg is just a way to add software to a separate directory (e.g. ''/ | ||
| - | Opkg is sometimes called // | + | Opkg is sometimes called // |
| The package manager '' | The package manager '' | ||
| Line 133: | Line 133: | ||
| ===== Examples ===== | ===== Examples ===== | ||
| + | ==== Basics ==== | ||
| <code bash> | <code bash> | ||
| # Install a package | # Install a package | ||
| Line 145: | Line 146: | ||
| </ | </ | ||
| + | ==== Extras ==== | ||
| You can make use of [[wp> | You can make use of [[wp> | ||
| Use a [[wp> | Use a [[wp> | ||
| Line 151: | Line 153: | ||
| opkg list | grep -e < | opkg list | grep -e < | ||
| opkg list | awk -e '/< | opkg list | awk -e '/< | ||
| - | opkg info kmod-ipt-* | awk -e '/ | + | opkg info kmod-nf-\* | awk -e '/ |
| opkg list-installed | awk -e ' | opkg list-installed | awk -e ' | ||
| for pkg in < | for pkg in < | ||
| Line 157: | Line 159: | ||
| </ | </ | ||
| - | :!: Mass upgrade of all packages is [[meta: | + | ==== Upgrading packages ==== |
| - | If you still want to proceed, set up [[docs: | + | <WRAP important> |
| + | Mass upgrade of all packages is [[meta: | ||
| + | The chance of soft-bricking your device is significant, so be fully prepared to perform a [[docs: | ||
| + | Proceed at your own risk. | ||
| + | </ | ||
| <code bash> | <code bash> | ||
| Line 299: | Line 305: | ||
| ==== Verbose opkg update ==== | ==== Verbose opkg update ==== | ||
| <code bash> | <code bash> | ||
| + | # Save the script | ||
| cat << " | cat << " | ||
| #!/bin/sh | #!/bin/sh | ||
| Line 305: | Line 312: | ||
| while read TYPE REPO URL | while read TYPE REPO URL | ||
| do | do | ||
| - | uclient-fetch | + | wget -O / |
| - | uclient-fetch | + | wget -O / |
| - | gunzip -k / | + | gunzip -k / |
| usign -V -P / | usign -V -P / | ||
| | grep -e " | | grep -e " | ||
| - | && | + | && |
| done < / | done < / | ||
| EOF | EOF | ||
| - | chmod +x ./opkg-update.sh | + | chmod +x opkg-update.sh |
| + | |||
| + | # Run the script | ||
| ./ | ./ | ||
| </ | </ | ||
| Line 325: | Line 334: | ||
| #!/bin/sh | #!/bin/sh | ||
| opkg update | opkg update | ||
| - | URLS=" | + | URL=" |
| | sed -n -e "/ | | sed -n -e "/ | ||
| rm -f / | rm -f / | ||
| - | for URL in ${URLS} | + | for URL in ${URL} |
| - | do FILES=" | + | do FILE=" |
| | tar -O -x -z ./ | | tar -O -x -z ./ | ||
| | tar -t -z \ | | tar -t -z \ | ||
| | sort -r \ | | sort -r \ | ||
| | sed -e " | | sed -e " | ||
| - | for FILE in ${FILES} | + | for FILE in ${FILE} |
| do if [ -f " | do if [ -f " | ||
| then rm -f " | then rm -f " | ||
| Line 343: | Line 352: | ||
| done | done | ||
| EOF | EOF | ||
| - | chmod +x ./opkg-rm-pkg-deps.sh | + | chmod +x opkg-rm-pkg-deps.sh |
| + | </ | ||
| + | |||
| + | <code bash> | ||
| # Run the script | # Run the script | ||
| - | ./ | + | ./ |
| # Reboot to make the free space visible | # Reboot to make the free space visible | ||
| Line 353: | Line 365: | ||
| ==== Local repository ==== | ==== Local repository ==== | ||
| - | There may be use cases where having a package repository on the device itself is advantageous. Such cases may include: | + | There may be use cases where having a package repository on the device itself is advantageous: |
| - | * Unreliable WANs, where the connectivity upstream of the device to a remote repository goes down for an unacceptable period of time | + | * Unreliable WANs, where the connectivity upstream of the device to a remote repository goes down for an unacceptable period of time. |
| - | * Bandwidth Caps, where the connectivity upstream of the device to a remote repository has a limited amount of data that can be fetched before the connectivity is throttled or goes down until the next period where the cap resets | + | * Bandwidth Caps, where the connectivity upstream of the device to a remote repository has a limited amount of data that can be fetched before the connectivity is throttled or goes down until the next period where the cap resets. |
| - | * A repository with customization; | + | * A repository with customization; |
| - | * The device acts as a reference device for other systems, to ensure that the package versions across the devices local to the network remain consistent | + | * The device acts as a reference device for other systems, to ensure that the package versions across the devices local to the network remain consistent. |
| - | + | Set up a local repository for your target. | |
| - | FIXME Convert this into LEDE and explain what it is actually doing. | + | Assuming about 2-3 GB of free space is available. |
| - | + | ||
| - | An example | + | |
| <code bash> | <code bash> | ||
| - | r=44685 | + | # Install packages |
| - | search=" | + | opkg update |
| - | replace=" | + | opkg install rsync |
| - | sed -i -e " | + | |
| - | </ | + | |
| - | To share the repository with other devices | + | # Save the script |
| + | cat << " | ||
| + | #!/bin/sh | ||
| + | . / | ||
| + | REPO_LOCAL=" | ||
| + | REPO_URL=" | ||
| + | case " | ||
| + | (snapshot) REPO_DIR=" | ||
| + | (*) REPO_DIR=" | ||
| + | esac | ||
| + | REPO_CORE=" | ||
| + | REPO_PKGS=" | ||
| + | for REPO_DIR in " | ||
| + | do mkdir -p " | ||
| + | rsync --bwlimit=" | ||
| + | " | ||
| + | " | ||
| + | done | ||
| + | EOF | ||
| + | chmod +x opkg-sync-local-repo.sh | ||
| - | <code bash> | + | # Run the script |
| - | ln -s / | + | ./opkg-sync-local-repo.sh |
| - | </code> | + | |
| - | On the second device, perform a similar search and replace using sed, but instead point to the first device' | + | # Configure Opkg to use local repo |
| + | . / | ||
| + | REPO_LOCAL=" | ||
| + | REPO_URL=" | ||
| + | sed -i -e " | ||
| - | <code bash> | + | # Share the repository on the LAN |
| - | r=44685 | + | ln -f -s ${REPO_LOCAL# |
| - | search=" | + | |
| - | replace=" | + | # Configure Opkg on the clients |
| - | sed -i -e "s!$search!$replace!" / | + | . / |
| + | REPO_LOCAL="http://192.168.1.1/ | ||
| + | REPO_URL=" | ||
| + | sed -i -e "s|${REPO_URL}|${REPO_LOCAL}|" /etc/opkg/distfeeds.conf | ||
| </ | </ | ||
| + | |||
| + | See also: [[: | ||
| ===== Non-standard installation destinations ===== | ===== Non-standard installation destinations ===== | ||
| Line 397: | Line 432: | ||
| </ | </ | ||
| - | The default opkg.conf actually contains three destinations: | + | The default |
| <code bash> | <code bash> | ||