debmaker/lib/exec_in_chroot.sh
2024-05-30 23:51:07 +02:00

82 lines
2.2 KiB
Bash
Executable file

#!/usr/bin/bash
base_package_upgrade(){
apt update
apt dist-upgrade -y
apt install -y git wget ca-certificates dpkg fakeroot gnupg2
}
install_package_dependency(){
apt update
apt-get install -y --no-install-recommends ${PACKAGE_DEPENDENCY}
}
get_git_source(){
GIT_PATH=/tmp/${APP}
[ ! "$1" == "" ] && GIT_PATH=$1
[ -e ${GIT_PATH} ] && rm -fr ${GIT_PATH}
if [ "${GIT_VERSION}" = "last" ] ;
then
git clone --depth 1 ${DEPOT} ${GIT_PATH}
else
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} ${GIT_PATH}
fi
}
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
}
configure_depot_nodejs() {
NODE_MAJOR=18
[ ! "$1" == "" ] && NODE_MAJOR=$1
echo -e "Package: nodejs\\nPin: version $NODE_MAJOR.*\\nPin-Priority: 1000" > /etc/apt/preferences.d/nodejs
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
}
install_go() {
GO_VERSION=1.22.3
[ ! "$1" == "" ] && GO_VERSION=$1
PATH=$PATH:/usr/local/go/bin
if [ -e /usr/local/go/bin/go ] || [ ! "$(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
}
install_rust() {
wget -qO - https://sh.rustup.rs > /tmp/rustup
bash /tmp/rustup -qy
}
install_clojure() {
wget -qO - https://download.clojure.org/install/linux-install-1.11.1.1155.sh | bash
}
install_composer(){
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
}
minimum_package() {
base_package_upgrade
}
default_prebuild(){
get_git_source
}
source /tmp/src/debmaker
if [ ! "$1" == "" ];
then
FUNC=$1
shift
${FUNC} $*
fi