2022-09-28 22:37:15 -06:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2022-10-10 12:12:19 -06:00
|
|
|
set -e
|
|
|
|
|
2022-09-28 22:37:15 -06:00
|
|
|
mkdir -p /tmp/openbsd_app/{stable,current}
|
|
|
|
|
|
|
|
CURRENT_FILE=${1:-/tmp/openbsd_app/current/share/sqlports}
|
|
|
|
STABLE_FILE=${2:-/tmp/openbsd_app/stable/share/sqlports}
|
|
|
|
|
|
|
|
(
|
|
|
|
cd /tmp/openbsd_app/current
|
2023-01-24 12:52:33 -07:00
|
|
|
curl -L -O https://cdn.openbsd.org/pub/OpenBSD/snapshots/packages/amd64/sqlports-7.37.tgz
|
2022-10-10 12:12:19 -06:00
|
|
|
curl -L -O https://cdn.openbsd.org/pub/OpenBSD/snapshots/packages/amd64/SHA256.sig
|
2023-03-28 15:52:14 -06:00
|
|
|
signify -C -p /etc/signify/openbsd-73-pkg.pub -x SHA256.sig sqlports-7.37.tgz
|
2023-01-24 12:52:33 -07:00
|
|
|
tar -C . -zxvf sqlports-7.37.tgz
|
2022-09-28 22:37:15 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
(
|
|
|
|
cd /tmp/openbsd_app/stable
|
2022-10-24 10:45:33 -06:00
|
|
|
curl -L -O https://cdn.openbsd.org/pub/OpenBSD/7.2/packages/amd64/sqlports-7.36p0.tgz
|
|
|
|
curl -L -O https://cdn.openbsd.org/pub/OpenBSD/7.2/packages/amd64/SHA256.sig
|
|
|
|
signify -C -p /etc/signify/openbsd-72-pkg.pub -x SHA256.sig sqlports-7.36p0.tgz
|
2022-09-28 22:37:15 -06:00
|
|
|
tar -C . -zxvf sqlports-7.36p0.tgz
|
|
|
|
)
|
|
|
|
|
|
|
|
SQL=$(cat <<EOF
|
|
|
|
ATTACH DATABASE '%s' AS ports;
|
|
|
|
|
|
|
|
CREATE VIRTUAL TABLE
|
|
|
|
%s
|
|
|
|
USING fts5(
|
|
|
|
FULLPKGNAME,
|
|
|
|
FULLPKGPATH,
|
|
|
|
COMMENT,
|
|
|
|
DESCRIPTION);
|
|
|
|
|
|
|
|
INSERT INTO
|
|
|
|
%s
|
|
|
|
(FULLPKGNAME, FULLPKGPATH, COMMENT, DESCRIPTION)
|
|
|
|
SELECT
|
|
|
|
fullpkgname,
|
|
|
|
_paths.fullpkgpath,
|
|
|
|
comment,
|
|
|
|
_descr.value
|
|
|
|
FROM
|
|
|
|
ports._ports
|
|
|
|
JOIN _paths ON _paths.id=_ports.fullpkgpath
|
|
|
|
JOIN _descr ON _descr.fullpkgpath=_ports.fullpkgpath;
|
|
|
|
|
|
|
|
EOF
|
|
|
|
)
|
|
|
|
|
2023-02-01 06:12:47 -07:00
|
|
|
rm -f ~/openbsd.app/combined.db
|
2022-09-28 22:37:15 -06:00
|
|
|
printf "$SQL\n" ${CURRENT_FILE} \
|
|
|
|
"current_ports_fts" \
|
2023-02-01 06:12:47 -07:00
|
|
|
"current_ports_fts" | sqlite3 ~/openbsd.app/combined.db
|
2022-09-28 22:37:15 -06:00
|
|
|
printf "$SQL\n" ${STABLE_FILE} \
|
|
|
|
"stable_ports_fts" \
|
2023-02-01 06:12:47 -07:00
|
|
|
"stable_ports_fts" | sqlite3 ~/openbsd.app/combined.db
|