Readme: Cleanup in inital setup area First setup: added Python webserver to serve the created images for easy deployment in Proxmox CacheAndRepo: Alpine will now always use Default repo for rootfs/core since the download methode in Distrobuilder has changed
59 lines
1.8 KiB
Bash
59 lines
1.8 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
|
|
}
|
|
|
|
#Build Jenkins Image
|
|
BuildImage Debian jenkins
|
|
#Build JenkinsNode (imgbuilder) Image
|
|
BuildImage Debian imgbuilder
|
|
|
|
read -p "Do you want to server image files on webserver? (yes/No) " runws
|
|
if [[ $runws == y* || $runws == Y* ]]; then
|
|
echo "Availible ip addresses"
|
|
ip -4 -o a
|
|
echo ""
|
|
echo "Dowload jenkins image: http://<IP>:8000/Debian-jenkins.tar.xz"
|
|
echo "Dowload imgbuilder image: http://<IP>:8000/Debian-imgbuilder.tar.xz"
|
|
echo ""
|
|
echo "To stop the webserver press ctrl + c"
|
|
python3 -m http.server >/dev/null
|
|
fi
|
|
|
|
echo Done |