mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
refactor(installer): remove dependency on the edge repository and download source code to temp dir
This commit is contained in:
parent
edb36c08f7
commit
47e8908489
1 changed files with 46 additions and 23 deletions
|
@ -585,15 +585,22 @@ preconfigurePackages(){
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${PLAT}" == 'Alpine' ]] && ! command -v grepcidr &> /dev/null; then
|
if [[ "${PLAT}" == 'Alpine' ]] && ! command -v grepcidr &> /dev/null; then
|
||||||
|
local down_dir
|
||||||
## install dependencies
|
## install dependencies
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
${SUDO} ${PKG_INSTALL} build-base make curl tar
|
${SUDO} ${PKG_INSTALL} build-base make curl tar
|
||||||
|
|
||||||
## download binaeries
|
if ! down_dir="$(mktemp -d)"; then
|
||||||
curl -fLo master.tar.gz https://github.com/pivpn/grepcidr/archive/master.tar.gz
|
echo "::: Failed to create download directory for grepcidr!"
|
||||||
tar -xzf master.tar.gz
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
cd grepcidr-master || exit 1
|
## download binaries
|
||||||
|
curl -fLo "${down_dir}/master.tar.gz" https://github.com/pivpn/grepcidr/archive/master.tar.gz
|
||||||
|
tar -xzC "${down_dir}" -f "${down_dir}/master.tar.gz"
|
||||||
|
|
||||||
|
(
|
||||||
|
cd "${down_dir}/grepcidr-master" || exit 1
|
||||||
|
|
||||||
## personalize binaries
|
## personalize binaries
|
||||||
sed -i -E -e 's/^PREFIX\=.*/PREFIX\=\/usr\nCC\=gcc/' Makefile
|
sed -i -E -e 's/^PREFIX\=.*/PREFIX\=\/usr\nCC\=gcc/' Makefile
|
||||||
|
@ -606,12 +613,7 @@ preconfigurePackages(){
|
||||||
echo "::: Failed to compile and install grepcidr!"
|
echo "::: Failed to compile and install grepcidr!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
) || exit 1
|
||||||
cd ..
|
|
||||||
|
|
||||||
## remove useless files
|
|
||||||
rm master.tar.gz
|
|
||||||
rm -rf grepcidr-master
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "USING_UFW=${USING_UFW}" >> ${tempsetupVarsFile}
|
echo "USING_UFW=${USING_UFW}" >> ${tempsetupVarsFile}
|
||||||
|
@ -2706,13 +2708,34 @@ confUnattendedUpgrades(){
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [[ "${PKG_MANAGER}" == 'apk' ]]; then
|
elif [[ "${PKG_MANAGER}" == 'apk' ]]; then
|
||||||
echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing/' | ${SUDO} tee -a /etc/apk/repositories && ${SUDO} apk -q update
|
local down_dir
|
||||||
|
## install dependencies
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
${SUDO} ${PKG_INSTALL} unzip asciidoctor
|
||||||
|
|
||||||
PIVPN_DEPS=(apk-autoupdate)
|
if ! down_dir="$(mktemp -d)"; then
|
||||||
|
echo "::: Failed to create download directory for apk-autoupdate!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
installDependentPackages PIVPN_DEPS[@]
|
## download binaries
|
||||||
|
curl -fLo "${down_dir}/master.zip" https://github.com/jirutka/apk-autoupdate/archive/refs/heads/master.zip
|
||||||
|
unzip -qd "${down_dir}" "${down_dir}/master.zip"
|
||||||
|
|
||||||
${SUDO} sed -i -E -e '/^https:\/\/dl\-cdn\.alpinelinux\.org\/alpine\/edge\/testing\/$/d' /etc/apk/repositories && ${SUDO} apk -q update
|
(
|
||||||
|
cd "${down_dir}/apk-autoupdate-master" || exit 1
|
||||||
|
|
||||||
|
## personalize binaries
|
||||||
|
sed -i -E -e 's/^(prefix\s*:=).*/\1 \/usr/' Makefile
|
||||||
|
|
||||||
|
## install
|
||||||
|
${SUDO} make install
|
||||||
|
|
||||||
|
if ! command -v apk-autoupdate &> /dev/null; then
|
||||||
|
echo "::: Failed to compile and install apk-autoupdate!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
) || exit 1
|
||||||
|
|
||||||
${SUDO} install -m 0755 "${pivpnFilesDir}/files/etc/apk/personal_autoupdate.conf" /etc/apk/personal_autoupdate.conf
|
${SUDO} install -m 0755 "${pivpnFilesDir}/files/etc/apk/personal_autoupdate.conf" /etc/apk/personal_autoupdate.conf
|
||||||
${SUDO} apk-autoupdate /etc/apk/personal_autoupdate.conf
|
${SUDO} apk-autoupdate /etc/apk/personal_autoupdate.conf
|
||||||
|
|
Loading…
Reference in a new issue