Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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:45] – [Local repository] vgaeteradocs: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 << "EOF" > opkg-update.sh cat << "EOF" > opkg-update.sh
 #!/bin/sh #!/bin/sh
Line 319: Line 320:
 done < /etc/opkg/distfeeds.conf done < /etc/opkg/distfeeds.conf
 EOF EOF
-chmod +x ./opkg-update.sh+chmod +x opkg-update.sh 
 + 
 +# Run the script
 ./opkg-update.sh ./opkg-update.sh
 </code> </code>
Line 349: Line 352:
 done done
 EOF EOF
-chmod +x ./opkg-rm-pkg-deps.sh+chmod +x opkg-rm-pkg-deps.sh 
 +</code> 
 + 
 +<code bash>
  
 # Run the script # Run the script
-./opkg-rm-pkg-deps.sh <package_name>+./opkg-rm-pkg-deps.sh package_name
  
 # 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; built from source, which isn't available from remote repositories +  * A repository with customization; built from source, which isn't available from remote repositories. 
-  * 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 << "EOF" > opkg-sync-local-repo.sh 
 +#!/bin/sh
 . /etc/os-release . /etc/os-release
-REPO_PFX="/${ID}" +REPO_LOCAL="file://${1:-/${ID}}/
-REPO_TARGET="releases/${VERSION_ID}/targets/${OPENWRT_BOARD}" +REPO_URL="https://downloads.${HOME_URL#*//}" 
-REPO_ARCH="releases/${VERSION_ID}/packages/${OPENWRT_ARCH}" +case "${VERSION_ID}" in 
-mkdir -p ${REPO_PFX}/${REPO_TARGET} ${REPO_PFX}/${REPO_ARCH+(snapshot) REPO_DIR="downloads/snapshots" ;; 
-rsync --bwlimit=8M --del -r -t -v \ +(*) REPO_DIR="downloads/releases/${VERSION_ID}" ;; 
-    rsync://downloads.openwrt.org/downloads/${REPO_TARGET}+esac 
-    ${REPO_PFX}/${REPO_TARGET}/ +REPO_CORE="${REPO_DIR}/targets/${OPENWRT_BOARD}" 
-rsync --bwlimit=8M --del -r -t -v \ +REPO_PKGS="${REPO_DIR}/packages/${OPENWRT_ARCH}
-    rsync://downloads.openwrt.org/downloads/${REPO_ARCH}/ \ +for REPO_DIR in "${REPO_CORE}" "${REPO_PKGS}" 
-    ${REPO_PFX}/${REPO_ARCH}/+do mkdir -p "${REPO_LOCAL#*//}${REPO_DIR#*/}" 
 +rsync --bwlimit="8M--del -r -t -v \ 
 +"${REPO_URL/https/rsync}${REPO_DIR}/
 +"${REPO_LOCAL#*//}/${REPO_DIR#*/}/
 +done 
 +EOF 
 +chmod +x opkg-sync-local-repo.sh
  
-# Configure Opkg +# Run the script 
-sed -i -e "s|https://downloads.openwrt.org/\ +./opkg-sync-local-repo.sh /openwrt 
-|file://${REPO_PFX}/|" /etc/opkg/distfeeds.conf+ 
 +# Configure Opkg to use local repo 
 +. /etc/os-release 
 +REPO_LOCAL="file:///${ID}/" 
 +REPO_URL="https://downloads.${HOME_URL#*//}" 
 +sed -i -e "s|${REPO_URL}|${REPO_LOCAL}|" /etc/opkg/distfeeds.conf
  
 # Share the repository on the LAN # Share the repository on the LAN
-ln -f -s ${REPO_PFX} /www/${ID}+ln -f -s ${REPO_LOCAL#*//} /www/${ID}
  
 # Configure Opkg on the clients # Configure Opkg on the clients
 . /etc/os-release . /etc/os-release
-sed -i -e "s|https://downloads.openwrt.org/+REPO_LOCAL="http://192.168.1.1/${ID}/
-|http://192.168.1.1/${ID}/|" /etc/opkg/distfeeds.conf+REPO_URL="https://downloads.${HOME_URL#*//}" 
 +sed -i -e "s|${REPO_URL}|${REPO_LOCAL}|" /etc/opkg/distfeeds.conf
 </code> </code>
 +
 +See also: [[:downloads#how_to_mirror|How to mirror]]
  
 ===== Non-standard installation destinations ===== ===== Non-standard installation destinations =====
  • Last modified: 2024/04/12 10:08
  • by virtualguy