From 9359602185cb1924050ab7ff0237e7c309c4b81e Mon Sep 17 00:00:00 2001 From: thomas Date: Fri, 5 Aug 2022 06:12:11 +0200 Subject: [PATCH] New dependancy methode --- lib/exec_in_chroot.sh | 33 +++++++++++++++++++++++++++++++++ ressources/adguardhome/debmaker | 11 ++++------- ressources/authelia/debmaker | 6 ++---- ressources/element-web/debmaker | 15 ++++----------- ressources/gitea/debmaker | 10 ++++------ 5 files changed, 47 insertions(+), 28 deletions(-) diff --git a/lib/exec_in_chroot.sh b/lib/exec_in_chroot.sh index 628f029..17efa48 100755 --- a/lib/exec_in_chroot.sh +++ b/lib/exec_in_chroot.sh @@ -1,4 +1,37 @@ #!/bin/bash + + +configure_depot_yarn() { + echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" > /etc/apt/sources.list.d/yarn.list +} + +configure_depot_nodejs() { + NODE_VERSION=16.x + [ ! "$1" == "" ] && NODE_VERSION=$1 + grep -q 16.x /etc/apt/sources.list.d/nodesource.list + if [ $? -ne 0 ] + then + if [ ! -e /usr/bin/wget ] + then + apt update + apt install wget + fi + wget -qO - https://deb.nodesource.com/setup_${NODE_VERSION} | bash + fi +} + +install_go() { + GO_VERSION=1.19 + [ ! "$1" == "" ] && GO_VERSION=$1 + PATH=$PATH:/usr/local/go/bin + if [ ! "$(go version)" == "go version go${GO_VERSION} linux/amd64" ] ; + then + rm -rvf /usr/local/go/ + wget -qO - https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xz + fi +} + + if [ ! "$1" == "" ]; then source /tmp/src/debmaker diff --git a/ressources/adguardhome/debmaker b/ressources/adguardhome/debmaker index 591cfad..c126a60 100755 --- a/ressources/adguardhome/debmaker +++ b/ressources/adguardhome/debmaker @@ -13,15 +13,12 @@ IMAGE_SIZE=4 STEP="envinit prebuild build makedeb" envinit() { + configure_depot_yarn + configure_depot_nodejs apt-get update apt-get dist-upgrade -y - apt install -y --no-install-recommends build-essential git wget ca-certificates dpkg fakeroot - wget -qO - https://deb.nodesource.com/setup_16.x | bash - wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarnkey.gpg - echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" > /etc/apt/sources.list.d/yarn.list - apt-get update - apt-get install -y nodejs yarn - wget -qO - https://go.dev/dl/go1.18.linux-amd64.tar.gz | tar -C /usr/local -xz + apt install -y --no-install-recommends build-essential git wget ca-certificates dpkg fakeroot nodejs yarn + install_go } prebuild(){ diff --git a/ressources/authelia/debmaker b/ressources/authelia/debmaker index 123939c..15b6672 100755 --- a/ressources/authelia/debmaker +++ b/ressources/authelia/debmaker @@ -17,10 +17,8 @@ envinit() { apt-get update apt-get dist-upgrade -y apt install -y --no-install-recommends git wget ca-certificates dpkg fakeroot build-essential - wget -qO - https://deb.nodesource.com/setup_16.x | bash - apt-get update - apt-get install -y nodejs - wget -qO - https://go.dev/dl/go1.18.3.linux-amd64.tar.gz | tar -C /usr/local -xz + install_nodejs + install_go wget -qO - https://get.pnpm.io/install.sh | sh - } diff --git a/ressources/element-web/debmaker b/ressources/element-web/debmaker index 402f337..1967b9f 100755 --- a/ressources/element-web/debmaker +++ b/ressources/element-web/debmaker @@ -14,18 +14,11 @@ IMAGE_SIZE=4 STEP="envinit prebuild build makedeb" envinit() { + configure_depot_yarn + configure_depot_nodejs apt-get update - if [ $(dpkg -l | grep -e 'ii nodejs ' | wc -l) -eq 1 ]; - then - apt-get dist-upgrade -y - else - apt install -y --no-install-recommends git wget ca-certificates dpkg fakeroot - wget -qO - https://deb.nodesource.com/setup_16.x | bash - wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarnkey.gpg - echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" > /etc/apt/sources.list.d/yarn.list - apt-get update - apt-get install -y yarn nodejs - fi + apt-get dist-upgrade -y + apt install -y --no-install-recommends git wget ca-certificates dpkg fakeroot yarn nodejs } prebuild(){ diff --git a/ressources/gitea/debmaker b/ressources/gitea/debmaker index 7d3e13c..93c4e2b 100755 --- a/ressources/gitea/debmaker +++ b/ressources/gitea/debmaker @@ -14,17 +14,15 @@ IMAGE_SIZE=5 STEP="envinit prebuild build makedeb" envinit() { + configure_depot_nodejs apt-get update apt-get dist-upgrade -y - apt install -y --no-install-recommends git wget ca-certificates dpkg fakeroot build-essential - wget -qO - https://deb.nodesource.com/setup_16.x | bash - apt-get update - apt-get install -y nodejs - wget -qO - https://go.dev/dl/go1.18.1.linux-amd64.tar.gz | tar -C /usr/local -xz + apt install -y --no-install-recommends git wget ca-certificates dpkg fakeroot build-essential nodejs + install_go } prebuild(){ - [ -e /tmp/git ] && rm -fr /tmp/${APP} + [ -e /tmp/${APP} ] && rm -fr /tmp/${APP} git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/${APP} }