#!/bin/bash
if [[ "`pwd`" =~ .*initrd.* ]]; then
INSTALL_ROOT="/"
else
[ -z "$INSTALL_ROOT" ] && INSTALL_ROOT="$(realpath .)"
INSTALL_ROOT="${INSTALL_ROOT%/}"
INSTALL_ROOT="${INSTALL_ROOT}/"
INSTALL_ROOT="${INSTALL_ROOT#/}"
fi
chroot_cmd(){
if [ -z "$INSTALL_ROOT" ] || [ "$INSTALL_ROOT" = "/" ]; then
"$1" "${@:2}"
else
chroot "$@"
fi
}
stacktrace() {
local frame=0 LINE SUB FILE
while read LINE SUB FILE < <(caller "$frame"); do
printf ' %s @ %s:%s' "${SUB}" "${FILE}" "${LINE}"
((frame++))
done
}
REPO_FILES=()
url_base=https://mirror.archlinux32.org
for db in core extra community core-testing extra-testing community-testing; do
if [ -f ${INSTALL_ROOT}var/packages/Packages-arch-32-$db ]; then
REPO_FILES+=(${INSTALL_ROOT}var/packages/Packages-arch-32-$db)
REPO_URLs+=("${url_base}")
fi
done
if [ -z "$DEPENDS_VIA_PINSTALL" ]; then
petget_cmd="$(stacktrace | grep petget/petget)"
DEPENDS_VIA_PINSTALL=no
[ ! -z "$petget_cmd" ] && DEPENDS_VIA_PINSTALL=yes
fi
if [ "$DEPENDS_VIA_PINSTALL" = yes ]; then
for a_pkg in ca-certificates- ca-certificates-mozilla ca-certificates-utils-; do
[ ! -z "$(cat ${INSTALL_ROOT}var/packages/user-installed-packages ${INSTALL_ROOT}var/packages/woof-installed-packages | grep "^$a_pkg")" ] && continue
for a_dir in ${INSTALL_ROOT}var/tmp ${INSTALL_ROOT}root; do
while read pkg_path; do
[ "$pkg_path" = EOF ] && break
petget $pkg_path && break 3
done < <(find $a_dir/$a_pkg* 2>/dev/null; echo EOF )
#cat $repo1 $repo2 $repo3 | grep "^$a_pkg"
done
i=0
while [ $i -lt "${#REPO_FILES[@]}" ]; do
repo=${REPO_FILES[$i]}
repo_url=${REPO_URLs[$i]}
{ grep "^$a_pkg" $repo ; echo EOF; } | \
while read line; do
[ "$line" = EOF ] && break
read pkg_path pkg_fname < <(echo "$line" | cut -d '|' -f7,8 | tr '|' ' ')
grep "^$a_pkg" ${INSTALL_ROOT}var/packages/
petget $repo_url/$pkg_path/$pkg_fname && break 2
done
i=$((i+1))
done
done
fi
#See: http://murga-linux.com/puppy/viewtopic.php?p=1050071#1050071
mv /etc/ca-certificates.conf /etc/ca-certificates.conf_back_$$
( cd /usr/share/ca-certificates
find . -name '*.crt' | sed 's#^./##' > /etc/ca-certificates.conf
)
#The following command is from: https://github.com/rbarrois/nss-systemcerts/blob/master/nss-systemcerts-import#L21
[ ! -d /etc/pki/nssdb ] && chroot_cmd nss-systemcerts-import
#The following command is from: https://packages.debian.org/sid/all/ca-certificates
chroot_cmd update-ca-certificates
#See:
# http://murga-linux.com/puppy/viewtopic.php?p=1050966#1050966
# https://wiki.archlinux.org/index.php/User:Grawity/Adding_a_trusted_CA_certificate#System-wide_%25E2%2580%2593_update-ca-certificates_%28Debian%2C_Ubuntu%29
chroot_cmd update-ca-trust
Comments
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|0 👍
/0 👎
0 B
|👍
/👎