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/12 12:20] – [Out of space] 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
-FIXME Convert this into LEDE and explain what it is actually doing+Assuming about 2-3 GB of free space is available.
- +
-An example of modifying the opkg.conf file using the sed utility, to change the repository source from the remote repository "downloads.openwrt.org/snapshots/trunk/ar71xx/generic", to a local repository mounted by the device and intended to be shared using the built-in web server to serve the repository files:+
  
 <code bash> <code bash>
-r=44685 +# Install packages 
-search="http://downloads.openwrt.org/snapshots/trunk/ar71xx/generic" +opkg update 
-replace="file:///mnt/sdcard/shared/users/www/r$r" +opkg install rsync
-sed -i -e "s!$search!$replace!" /etc/opkg.conf +
-</code>+
  
-To share the repository with other devices local to the network, use the following shell codeThis creates a hard link from the mounted directory to the web server root directory, so the web server can traverse the link and see the mounted filesystem:+# Save the script 
 +cat << "EOF" > opkg-sync-local-repo.sh 
 +#!/bin/sh 
 +. /etc/os-release 
 +REPO_LOCAL="file://${1:-/${ID}}/" 
 +REPO_URL="https://downloads.${HOME_URL#*//}" 
 +case "${VERSION_ID}" in 
 +(snapshot) REPO_DIR="downloads/snapshots" ;; 
 +(*) REPO_DIR="downloads/releases/${VERSION_ID}" ;; 
 +esac 
 +REPO_CORE="${REPO_DIR}/targets/${OPENWRT_BOARD}" 
 +REPO_PKGS="${REPO_DIR}/packages/${OPENWRT_ARCH}" 
 +for REPO_DIR in "${REPO_CORE}" "${REPO_PKGS}" 
 +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
  
-<code bash> +# Run the script 
-ln -s /mnt/sdcard/shared/users/www /www/pendrive +./opkg-sync-local-repo.sh /openwrt
-</code>+
  
-On the second device, perform a similar search and replace using sed, but instead point to the first device's IP address (in this case 192.168.1.1), and web path, all from the /etc/opkg.conf file:+# 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
  
-<code bash> +# Share the repository on the LAN 
-r=44685 +ln -f -s ${REPO_LOCAL#*///www/${ID} 
-search="downloads.openwrt.org/snapshots/trunk/ar71xx/generic" + 
-replace="192.168.1.1/pendrive/r$r+# Configure Opkg on the clients 
-sed -i -e "s!$search!$replace!" /etc/opkg.conf+. /etc/os-release 
 +REPO_LOCAL="http://192.168.1.1/${ID}/
 +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