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 [2023/03/27 12:42] – [Local repository] update vgaetera | docs:guide-user:additional-software:opkg [2023/04/03 00:34] – [Local repository] update vgaetera | ||
|---|---|---|---|
| Line 305: | Line 305: | ||
| ==== Verbose opkg update ==== | ==== Verbose opkg update ==== | ||
| <code bash> | <code bash> | ||
| + | # Save the script | ||
| cat << " | cat << " | ||
| #!/bin/sh | #!/bin/sh | ||
| Line 319: | Line 320: | ||
| done < / | done < / | ||
| EOF | EOF | ||
| - | chmod +x ./opkg-update.sh | + | chmod +x opkg-update.sh |
| + | |||
| + | # Run the script | ||
| ./ | ./ | ||
| </ | </ | ||
| Line 349: | 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 359: | 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. | Set up a local repository for your target. | ||
| - | Assuming about 2-3 GB of free space is required. | + | Assuming about 2-3 GB of free space is available. |
| <code bash> | <code bash> | ||
| - | # Create a local repository | + | # Install packages |
| + | opkg update | ||
| + | opkg install rsync | ||
| + | |||
| + | # Save the script | ||
| + | cat << " | ||
| + | #!/bin/sh | ||
| . / | . / | ||
| - | REPO_PFX="/ | + | REPO_LOCAL="file:// |
| - | REPO_TARGET="releases/${VERSION_ID}/targets/${OPENWRT_BOARD}" | + | REPO_URL="https://downloads.${HOME_URL#*//}" |
| - | REPO_ARCH=" | + | case "${VERSION_ID}" |
| - | mkdir -p ${REPO_PFX}/${REPO_TARGET} ${REPO_PFX}/${REPO_ARCH} | + | (snapshot) REPO_DIR="downloads/ |
| - | rsync --bwlimit=8M --del -r -t -v \ | + | (*) REPO_DIR=" |
| - | rsync:// | + | esac |
| - | | + | REPO_CORE=" |
| - | rsync --bwlimit=8M --del -r -t -v \ | + | REPO_PKGS=" |
| - | | + | for REPO_DIR in "${REPO_CORE}" "${REPO_PKGS}" |
| - | ${REPO_PFX}/${REPO_ARCH}/ | + | do mkdir -p "${REPO_LOCAL# |
| + | rsync --bwlimit="8M" | ||
| + | " | ||
| + | "${REPO_LOCAL# | ||
| + | done | ||
| + | EOF | ||
| + | chmod +x opkg-sync-local-repo.sh | ||
| - | # Configure Opkg | + | # Run the script |
| - | sed -i -e "s|https:// | + | ./ |
| - | |file://${REPO_PFX}/|" / | + | |
| + | # Configure Opkg to use local repo | ||
| + | . /etc/os-release | ||
| + | REPO_LOCAL=" | ||
| + | REPO_URL=" | ||
| + | sed -i -e "s|${REPO_URL}|${REPO_LOCAL}|" / | ||
| # Share the repository on the LAN | # Share the repository on the LAN | ||
| - | ln -f -s ${REPO_PFX} /www/${ID} | + | ln -f -s ${REPO_LOCAL# |
| # Configure Opkg on the clients | # Configure Opkg on the clients | ||
| - | sed -i -e " | + | . /etc/ |
| - | |http:// | + | REPO_LOCAL=" |
| + | REPO_URL=" | ||
| + | sed -i -e " | ||
| </ | </ | ||
| + | |||
| + | See also: [[: | ||
| ===== Non-standard installation destinations ===== | ===== Non-standard installation destinations ===== | ||