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 13:13] – [Local repository] 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. | ||
| Line 373: | Line 379: | ||
| opkg install rsync | opkg install rsync | ||
| - | # Create a local repository | + | # Save the script |
| + | cat << " | ||
| + | #!/bin/sh | ||
| . / | . / | ||
| - | OPENWRT_URL="https://downloads.openwrt.org/" | + | REPO_LOCAL="file://${1: |
| - | REPO_URL=" | + | REPO_URL=" |
| - | REPO_TARGET=" | + | case "${VERSION_ID}" in |
| - | REPO_ARCH="releases/${VERSION_ID}/ | + | (snapshot) REPO_DIR=" |
| - | mkdir -p ${REPO_URL#*//}${REPO_TARGET} ${REPO_URL#*//}${REPO_ARCH} | + | (*) REPO_DIR="downloads/releases/ |
| - | rsync --bwlimit=8M --del -r -t -v \ | + | esac |
| - | ${OPENWRT_URL/ | + | REPO_CORE=" |
| - | ${REPO_URL#*//}${REPO_TARGET}/ | + | REPO_PKGS="${REPO_DIR}/ |
| - | rsync --bwlimit=8M --del -r -t -v \ | + | for REPO_DIR in " |
| - | | + | do mkdir -p "${REPO_LOCAL#*//}${REPO_DIR#*/}" |
| - | ${REPO_URL#*//}${REPO_ARCH}/ | + | rsync --bwlimit="8M" |
| + | "${REPO_URL/ | ||
| + | "${REPO_LOCAL#*//}/${REPO_DIR#*/}/" | ||
| + | done | ||
| + | EOF | ||
| + | chmod +x opkg-sync-local-repo.sh | ||
| - | # Configure Opkg | + | # Run the script |
| - | sed -i -e "s|${OPENWRT_URL}|${REPO_URL}|" / | + | ./ |
| + | |||
| + | # Configure Opkg to use local repo | ||
| + | . / | ||
| + | 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 | ||
| . / | . / | ||
| - | OPENWRT_URL="https://downloads.openwrt.org/" | + | REPO_LOCAL="http://192.168.1.1/${ID}/" |
| - | REPO_URL=" | + | REPO_URL=" |
| - | sed -i -e "s|${OPENWRT_URL}|${REPO_URL}|" / | + | sed -i -e "s|${REPO_URL}|${REPO_LOCAL}|" / |
| </ | </ | ||
| + | |||
| + | See also: [[: | ||
| ===== Non-standard installation destinations ===== | ===== Non-standard installation destinations ===== | ||