debmaker/lib/exec_in_chroot.sh

83 lines
2.2 KiB
Bash
Raw Normal View History

2023-06-12 15:30:48 +02:00
#!/usr/bin/bash
2022-08-05 06:12:11 +02:00
2022-08-17 20:35:16 +02:00
base_package_upgrade(){
apt update
2022-08-17 20:35:16 +02:00
apt dist-upgrade -y
apt install -y git wget ca-certificates dpkg fakeroot gnupg2
}
2022-08-17 20:35:16 +02:00
install_package_dependency(){
2023-09-06 00:44:21 +02:00
apt update
2022-08-17 20:35:16 +02:00
apt-get install -y --no-install-recommends ${PACKAGE_DEPENDENCY}
}
get_git_source(){
2023-09-02 22:51:34 +02:00
GIT_PATH=/tmp/${APP}
[ ! "$1" == "" ] && GIT_PATH=$1
[ -e ${GIT_PATH} ] && rm -fr ${GIT_PATH}
2022-08-17 20:35:16 +02:00
if [ "${GIT_VERSION}" = "last" ] ;
then
2023-09-02 22:51:34 +02:00
git clone --depth 1 ${DEPOT} ${GIT_PATH}
2022-08-17 20:35:16 +02:00
else
2023-09-02 22:51:34 +02:00
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} ${GIT_PATH}
2022-08-17 20:35:16 +02:00
fi
}
2022-08-05 06:12:11 +02:00
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
wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarnkey.gpg
2022-08-05 06:12:11 +02:00
}
configure_depot_nodejs() {
2024-03-17 23:55:26 +01:00
NODE_MAJOR=18
2023-09-06 00:44:21 +02:00
[ ! "$1" == "" ] && NODE_MAJOR=$1
2023-09-15 23:10:23 +02:00
2023-09-06 00:44:21 +02:00
echo -e "Package: nodejs\\nPin: version $NODE_MAJOR.*\\nPin-Priority: 1000" > /etc/apt/preferences.d/nodejs
2024-03-17 23:55:26 +01:00
echo "deb https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" > /etc/apt/sources.list.d/nodesource.list
[ -f /etc/apt/trusted.gpg.d/nodesource.gpg ] || wget -qO - https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/nodesource.gpg
2022-08-05 06:12:11 +02:00
}
install_go() {
2023-09-15 23:10:23 +02:00
GO_VERSION=1.21.1
2022-08-05 06:12:11 +02:00
[ ! "$1" == "" ] && GO_VERSION=$1
PATH=$PATH:/usr/local/go/bin
2023-09-02 22:51:34 +02:00
if [ -e /usr/local/go/bin/go ] || [ ! "$(go version)" == "go version go${GO_VERSION} linux/amd64" ] ;
2023-07-11 23:00:08 +02:00
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
2022-08-05 06:12:11 +02:00
}
install_rust() {
wget -qO - https://sh.rustup.rs > /tmp/rustup
bash /tmp/rustup -qy
}
2022-09-21 01:59:25 +02:00
install_clojure() {
2022-08-17 20:35:16 +02:00
wget -qO - https://download.clojure.org/install/linux-install-1.11.1.1155.sh | bash
}
2023-07-30 22:08:46 +02:00
install_composer(){
2024-03-17 23:55:26 +01:00
wget https://getcomposer.org/installer -O /tmp/composer-setup.php
php /tmp/composer-setup.php --install-dir=/usr/bin
rm /tmp/composer-setup.php
mv /usr/bin/composer.phar /usr/bin/composer
2023-07-30 22:08:46 +02:00
}
2023-07-11 23:00:08 +02:00
minimum_package() {
base_package_upgrade
}
2022-08-17 20:35:16 +02:00
default_prebuild(){
get_git_source
}
2022-09-10 18:11:22 +02:00
source /tmp/src/debmaker
2022-08-05 06:12:11 +02:00
2022-02-20 15:02:18 +01:00
if [ ! "$1" == "" ];
2022-09-10 18:11:22 +02:00
then
2022-02-20 15:02:18 +01:00
FUNC=$1
shift
${FUNC} $*
fi