Skip to content

Commit 41d8cf3

Browse files
committed
src: small audit regarding "pkg" use
Running the grep below lights up a few spots still: # git grep 'pkg[^/\[\.a-z'"'"',()_+"]' Make a few decisions for the future: * Use "pkg-static" outside the firmware code consistently with a full path * Modify ambiguous code or comments to not be found by the grep above * Firmware uses PKG now if we ever have to pivot to pkg-static or when we need to overwise modify the call. The goal of this excerise was to find all stray package manager spots that may run their own embedded pkg-update without the proper environment which should be gone for now.
1 parent 3849d4c commit 41d8cf3

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ For php code you will need to have `phpcs` and `phpcbf` installed.
113113
You can use the package `php-codesniffer` on Debian/Ubuntu.
114114
Python code will require `pycodestyle`.
115115

116-
For easier development you may want to use an OPNsense VM and run:
117-
`pkg install os-debug` that will install all the necessary tools.
116+
For easier development you may want to use an OPNsense VM and install
117+
the `os-debug` plugin that will offer the necessary tools.
118118

119119
make sweep
120120
----------

src/etc/rc.syshook.d/upgrade/10-sanity.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ -z "${CORE}" ]; then
77
exit 1
88
fi
99

10-
if [ -z "$(pkg query %n ${CORE})" ]; then
10+
if [ -z "$(/usr/local/sbin/pkg-static query %n ${CORE})" ]; then
1111
echo "Core package \"${CORE}\" not known to package database."
1212
exit 1
1313
fi
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

3-
# run a cleanup beforehand to avoid later pkg-upgrade failures
3+
# run a cleanup beforehand to avoid later upgrade failures
44
opnsense-update -Fs

src/opnsense/scripts/firmware/check.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fi
109109
(${PKG} update -f 2>&1) | ${TEE} ${LOCKFILE} ${OUTFILE}
110110

111111
# always update the package manager so we can see the real updates directly
112-
(${PKG} upgrade -r ${product_repo} -Uy pkg 2>&1) | ${TEE} ${LOCKFILE}
112+
(${PKG} upgrade -r ${product_repo} -Uy 'pkg' 2>&1) | ${TEE} ${LOCKFILE}
113113

114114
# parse early errors
115115
if grep -q 'No address record' ${OUTFILE}; then

src/opnsense/scripts/firmware/hostnames.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
URLS=$(opnsense-update -M; opnsense-update -X)
3131

32-
# Make a few assumptions about plugged pkg repositories:
32+
# Make a few assumptions about plugged package repositories:
3333
#
3434
# * grab the "url" key, delimited with double quotes
3535
# * remove the spurious "pkg+" prefix to treat it as raw HTTP(S)

src/www/crash_reporter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function upload_crash_report($files, $agent)
8484

8585
include('head.inc');
8686

87-
$plugins = implode(' ', explode("\n", shell_safe('pkg info -g "os-*"')));
87+
$plugins = implode(' ', explode("\n", shell_safe('/usr/local/sbin/pkg-static info -g "os-*"')));
8888
$product = product::getInstance();
8989

9090
$crash_report_header = sprintf(

0 commit comments

Comments
 (0)