Files
HomeServerCTs/Scripts/FirstSetup.sh
Bram Prieshof 6c182a2ec7 Fixed FirstSetup and upgraded Alpine to 3.16 version
"FirstSetup": now installes go form official website

CT ElkarbackupALP: New use old stable repo(3.15) for php7 since is is obeleted in 3.16

CT HeimdallCT: Switched to php8 and when git cloing using 2.x branch instead of master
2022-07-01 00:45:21 +02:00

48 lines
1.4 KiB
Bash

#!/bin/bash
#Vars
#Goto ProjectRoot
cd "$( cd "$( dirname "$0" )" &> /dev/null && pwd )/.."
echo "The script will now install required dependencies"
read -r -s -p $'Press enter to continue, or ctrl+c to quit'
#Install software dependencies
apt install ca-certificates git make debootstrap curl gcc libc-dev nano gnupg2 rsync xz-utils --no-install-recommends -y
#Install go
rm -rf /usr/local/go
curl -L https://go.dev/dl/go$(curl -Ls https://go.dev/VERSION?m=text |sed 's/go//g').linux-amd64.tar.gz -o /tmp/go.tar.gz
tar -C /usr/local -xzf /tmp/go.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile
export PATH=$PATH:/usr/local/go/bin
#Get Source for DistroBuilder
git clone https://github.com/lxc/distrobuilder distrobuilderSRC
cd distrobuilderSRC
#Run Build for Build
gofmt -s -w .
go build -o ../ -v ./...
#Cleanup
cd ../
rm -rf distrobuilderSRC
#Disable use of cache Server
bash Scripts/UpdateIMGBuildFile-CacheAndRepo.sh -d
#Allow XZ to use all cores
export XZ_DEFAULTS="-T 0"
#Function for building LXC images
BuildImage () {
local Distro=$1
local Variant=$2
./distrobuilder build-lxc CT-Build/$Distro.yaml -o image.variant=$Variant
rm -f meta.tar.xz
mv ./rootfs.tar.xz "$Distro-$Variant".tar.xz
}
#Get resources
bash Scripts/GetExternalResources.sh
#Build Jenkins Image
BuildImage Debian jenkins
#Build JenkinsNode (imgbuilder) Image
BuildImage Debian imgbuilder