Zernit/QA/travis-ci/before-install.sh
Kreyren d256ff6c67
Master init (#40)
* fdjfgjdfg

* jghkfghkf

* fgdfjfghj

* sgassg

* jksdhgjkasdnh

* Adapted code

* add vlang

* hkghkgh

* sdgasdg

* sagsdag

* gjghfj

* hjfghkf

* dgsghafh

* gjfgjfd

* fdhfhfgj

* Update gitpod.Dockerfile

* fixes

* fixes

* gjhfhghk

* xdgad

* dsgasdg

* shebang test

* sagaga

* shash

* jfhjgh

* hfgdj

* dgsdfhsdf

* Update gitpod.Dockerfile

* dshsfd

* hgkgk

* ffhdfgj

* Update vlang_init.sh

* Update vlang_init.sh

* agsah

* ffgjghjfgh

* jghkfg

* jghjfh

* hdhsfdh

* fdhfgj

* fdhsfdh

* fghdfgh

* sdgag

* dshas

* vcmvmvb

* sdagasdg

* shfdh

* sdagsdag

* dfhfgd

* Update cargo-make requirement from 0.26.2 to 0.27.0

Updates the requirements on [cargo-make](https://github.com/sagiegurari/cargo-make) to permit the latest version.
- [Release notes](https://github.com/sagiegurari/cargo-make/releases)
- [Changelog](https://github.com/sagiegurari/cargo-make/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sagiegurari/cargo-make/compare/0.26.2...0.27.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* test

* Bump termcolor from 1.0.0 to 1.1.0

Bumps [termcolor](http://pypi.python.org/pypi/termcolor) from 1.0.0 to 1.1.0.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* fdhsfh

* Create jekyll.yml

* dsadsh

* fdhgj

* sagsag

* sagag

* hfgj

* sdgsdag

* dgasdga

* hghkh

* sagas

* gjkghkf

* safsaf

* gjfkf

* stub

* djknsfdjknh

* sdgasdg

* asasg

* safsa

* gagsd

* IT'S YOUR TURN TRAVIS MUHAHAH

* shfdhsfd

* gfgj

* dfhfgdj

* fgkfhg

* fdhhsf

* fghkjgh

* fhdfjh

* safsa

* sagasga

* sdgdsfh

* saagsga

* gjhlghl

* jklhj

* gfghkg

* gfjdfgj

* nm,;n

* kljlk'j

* jk'jkl'

* saasga

* sdgasdg

* gjghk

* dhsfh

* fdhsfdj

* hkgjkgh

* asgsa

* fhfgjfg

* RUNALISA!

* asgas

* sasgd

* fdfgj

* dsfhdsf

* fhdfhs

* sagasg

* sagasg

* Fix C and adapt more sanity checks

* shdfh

* sagsag

* safasf

* sag

* hgjl

* asgasg

* sgagsa

* asfasf

* safasf

* sasag

* fdjfgj

* fjdgj

* sagasg

* Why can't i see the hugging source for this GUI? #ThanksMicrosoft

* saksdakhla

* jhlgj

* hjglh

* sdgdasg

* saga

* safsaf

* sagag

* fdhsfdh

* safasf

* fdhjsfdh

* PLEASE JUST FUCKING WORK

* SAGSAG

* sagasg

* agaahds

* end my suffering

* hgkkfkg

* all hail twofifths the savior

* sagasga

* fdhfgh

* dgsgh

* khgk

* asgasg

* ddfjhfg

* asgagasg

* fhdshfd

* asasgsagas

* hgkg

* saasg

* saagg

* ffdjgf

* hlj

* vbbghkk

* safasf

* safsaf

* sdhdfh

* fdhsdh

* saag

* sagag

* safasf

* asgasg

* ffgjfg

* f54hs6f5d4h

* sagasg

* dsgasg

* sgasdg

* gfjfgj

* cfghd

* fhddfgj

* dsgsagd

* shsadh

* fhdf

* fdjhfg

* asgasga

* sdgag

* fjfdgjdf

* fdhsfdh

* asgsa

* sagasg

* sagasg

* sagasg

* dsgsdha

* fdhsfhd

* YoU cAnT dO tHiS iN ShElL kReY

* tetats

* gfjdfgj

* sagsag

* fgj

* bvghkf

* gfhdfghfg

* sdagsadg

* sdgasdg

* agaas

* dassfd

* vbghf

* jghkgh

* hfgdj

* gjkjlg

* sdgfdg

* asgag

* fgkgkh

* fdhsfdh

* dsgasdg

* dsgsg

* fgj

* safsaf

* agsgd

* Finally we have theia config

Relevant: https://github.com/gitpod-io/gitpod/issues/800#issuecomment-587381366

* agsdgh

* kjghkgg

* vjfgjfgd

* add dia

* flowchart: init

* adgasdg

* Update Zernit.drawio

* Update Zernit.drawio

* Update Zernit.drawio

* asdgsdag

* fddfhs

* saasg

* sasag

* dgasdgasd

* dsgasdg

* Create question.md

* Update labels.yml

* do not bother bug wranglers with questions

* sasaasgd

* dhfdh

* safasf

* dsgasdg

* Update debian.Dockerfile

* dsagasdg

* Update debian.Dockerfile

* sdghsdf

* agasd

* Update cargo-make requirement from 0.27.0 to 0.28.0 (#58)

Updates the requirements on [cargo-make](https://github.com/sagiegurari/cargo-make) to permit the latest version.
- [Release notes](https://github.com/sagiegurari/cargo-make/releases)
- [Changelog](https://github.com/sagiegurari/cargo-make/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sagiegurari/cargo-make/compare/0.27.0...0.28.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* stub for RXT ownership

* Create other.md

* Create legal-request.yml

* Rename legal-request.yml to legal-request.md

* Update bug_report.md

* sgsfdh

* saga

* stub license

* Initial configuration

Co-authored-by: @Klairm <ivangardis@hotmail.com>
- Thanks for C contrib!
Co-authored-by: @Uniminin <uniminin@zoho.com> 
- Thanks for the contribution of annoyance and python!
Co-authored-by: @JesterOrNot <seanhellum45@gmail.com>
- Thanks for gitpod contrib! https://github.com/RXT0112/Zernit/pull/32
- Thanks for issue-meggage in https://github.com/RXT0112/Zernit/pull/23!
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-18 07:23:24 +01:00

215 lines
7.7 KiB
Bash
Executable File

#!/bin/bash
# shellcheck disable=SC1117
# Copyright 2019 Jacob Hrbek <kreyren@rixotstudio.cz>
# Distributed under the terms of the GNU General Public License v3 (https://www.gnu.org/licenses/gpl-3.0.en.html) or later
# Based in part upon 'before-install' from rsplib (https://raw.githubusercontent.com/dreibh/rsplib/master/ci/before-install), which is:
# Copyright (C) 2018-2019 by Thomas Dreibholz <dreibh@iem.uni-due.de> as GPLv3 or any other GPL at your option
# shellcheck source=QA/travis-ci/travis-common.sh
. "QA/travis-ci/travis-common.sh"
# shellcheck source=QA/travis-ci/get-container.sh
. "QA/travis-ci/get-container.sh"
fixme "Travis - before-install.sh disables SC1117 as hotfix"
# Linux as-is
if [ "$TRAVIS_OS_NAME" = linux ] && [ -z "$DOCKER" ] && [ -z "$QEMU" ]; then
# Nothing else to do
true
# Linux via Docker
elif [ "$TRAVIS_OS_NAME" = linux ] && [ -n "$DOCKER" ] && [ -z "$QEMU" ]; then
# The build machine therefore needs a sufficient amount of RAM!
[ -e "$CONTAINER" ] && sudo docker rm -f "$CONTAINER"
sudo docker run -d \
--name "$CONTAINER" \
--tmpfs /var/cache/pbuilder:rw,exec,dev,size=4g \
--tmpfs /var/lib/mock:rw,exec,dev,size=4g \
--cap-add=SYS_ADMIN --cap-add=NET_ADMIN \
--security-opt apparmor:unconfined \
-v "$(pwd):/travis" -w /travis \
"$DOCKER" tail -f /dev/null
sudo docker ps
# Exherbo via Docker
elif [ "$TRAVIS_OS_NAME" = 'Exherbo Linux' ] && [ -n "$DOCKER" ] && [ -z "$QEMU" ]; then
# The build machine therefore needs a sufficient amount of RAM!
[ -e "$CONTAINER" ] && sudo docker rm -f "$CONTAINER"
# Run docker
sudo docker run -d \
--name "$CONTAINER" \
--cap-add=SYS_ADMIN --cap-add=NET_ADMIN \
--security-opt apparmor:unconfined \
-v "$(pwd):/travis" -w /travis \
# FreeBSD via QEMU
# QA: Convert on POSIX-compatible
elif [ "$TRAVIS_OS_NAME" = linux ] && [ "$QEMU" = FreeBSD ]; then
if [ -n "$VARIANT" ]; then
sudo mkdir -p /vservers/qemu-freebsd
sudo chown "$USER:$USER" /vservers/qemu-freebsd
mkdir -p /vservers/qemu-freebsd/mnt
cd /vservers/qemu-freebsd || die "Unable to change directory in '/vservers/qemu-freebsd'"
# Download image
imageName="FreeBSD-$VARIANT-amd64.raw"
if [ -e "$imageName.xz" ] && [ ! -e "$imageName" ]; then
printf '%s\n' "Extracting existing $imageName.xz ..."
xz -T0 -dk "$imageName.xz"
elif [ ! -e "$imageName.xz" ] || [ ! -e "$imageName" ]; then
imageURL="https://download.freebsd.org/ftp/releases/VM-IMAGES/$VARIANT/amd64/Latest/$imageName.xz"
info "Downloading FreeBSD VM image from $imageURL ..."
curl "$imageURL" | tee "$imageName.xz.tmp" | xz -T0 -d - ">$imageName"
mv "$imageName.xz.tmp" "$imageName.xz" || die "Unable to rename $imageName.xz.tmp in $imageName.xz"
fi
# Modify FreeBSD image
pushd /vservers/qemu-freebsd/
# Grow image
truncate -s 128G "$imageName"
echo -e "w\nY\nY\n" | LANG=C gdisk "$imageName"
parted -s "$imageName" resizepart 3 100%
parted -s "$imageName" print
# Mount
ls -l "$imageName"
mountPoint="$(pwd)/mnt"
sudo umount "$mountPoint" 2>/dev/null || true
LOOPDEVS="$(sudo losetup -j "$imageName" | awk '{ print $1 }' | sed -e "s/:$//g")"
for loopdev in $LOOPDEVS ;do
sudo losetup -d "$loopdev" || true
done
sudo losetup -P -f "$imageName"
sudo losetup -j "$imageName"
LOOPDEV="$(sudo losetup -j "$imageName" | awk '{ print $1 }' | sed -e "s/:$//g")"
echo "sudo fuse-ufs2/fuse-ufs/fuse-ufs ${LOOPDEV}p3 $mountPoint -o rw"
sudo fuse-ufs2/fuse-ufs/fuse-ufs "${LOOPDEV}p3" "$mountPoint" -o rw
# Modify
# Set up networking:
sudo cp "$mountPoint/etc/rc.conf" .
sudo bash -c "(
echo \"sshd_enable=\\\"YES\\\"\"
echo \"ifconfig_vtnet0=\\\"DHCP\\\"\"
echo \"ifconfig_vtnet1=\\\"inet 192.168.100.100 netmask 255.255.255.0\\\"\"
echo \"nfs_client_enable=\\\"YES\\\"\"
echo \"rpc_lockd_enable=\\\"YES\\\"\"
echo \"rpc_statd_enable=\\\"YES\\\"\"
) >>$mountPoint/etc/rc.conf"
# Make sure that FreeBSD uses the latest packages:
sudo sed -e 's#"pkg+http://pkg.FreeBSD.org/${ABI}/quarterly"#"pkg+http://pkg.FreeBSD.org/${ABI}/latest"#g' -i "$mountPoint/etc/pkg/FreeBSD.conf"
# Make sure that the /usr/ports directory is there.
sudo mkdir -p "$mountPoint/usr/ports"
# Add SSH public key authentication:
sudo mkdir -p "$mountPoint/root/.ssh"
sudo chmod 700 "$mountPoint/root/.ssh"
if [ ! -e "$HOME/.ssh/id_rsa" ]; then
ssh-keygen -t rsa -b 4096 -P "" -f "$HOME/.ssh/id_rsa"
fi
sudo cp "$HOME/.ssh/id_rsa.pub" "$mountPoint/root/.ssh/authorized_keys"
sudo chmod 600 "$mountPoint/root/.ssh/authorized_keys"
sudo bash -c "echo \"PermitRootLogin prohibit-password\" >>$mountPoint/etc/ssh/sshd_config"
# sudo tail -n 6 ${mountPoint}/etc/ssh/sshd_config
# Set up NFS:
sudo mkdir -p "$mountPoint/travis"
sudo sed -e "/^.*\/travis.*$/d" -i~ "$mountPoint/etc/fstab"
sudo bash -c "( echo \"192.168.100.1:/travis /travis nfs rw,soft,async,noatime,nfsv3,rsize=65536,wsize=65536 0 0\" ; echo \"tmpfs /usr/ports tmpfs rw 0 0\" ) >>$mountPoint/etc/fstab"
sudo cat "$mountPoint/etc/fstab"
# Unmount
sudo umount "$mountPoint"
sudo losetup -d "$LOOPDEV"
popd
# Host-only networking
sudo ip link add br0 type bridge || true
sudo ip addr flush dev br0
sudo ip addr add 192.168.100.1/24 brd 192.168.100.255 dev br0
sudo ip tuntap add mode tap
sudo ip link set tap0 master br0
sudo ip link set dev br0 up
sudo ip link set dev tap0 up
sudo iptables -A INPUT -i tap0 -s 192.168.100.0/24 -j ACCEPT
sudo iptables -A OUTPUT -o tap0 -d 192.168.100.0/24 -j ACCEPT
sudo iptables -A INPUT -i br0 -s 192.168.100.0/24 -j ACCEPT
sudo iptables -A OUTPUT -o br0 -d 192.168.100.0/24 -j ACCEPT
sudo iptables -A FORWARD -s 192.168.100.0/24 -d 192.168.100.0/24
# sudo dnsmasq --interface=br0 --bind-interfaces \
# --dhcp-range=192.168.100.2,192.168.100.254 || true
# NFS
sudo mkdir -p /travis
sudo mount --bind "$(pwd)" /travis
sudo bash -c "echo \"/travis 192.168.100.0/24(rw,no_root_squash)\" >/etc/exports"
env LANG=C.UTF-8 ci/retry -t "$RETRY_MAXTRIALS" -p "$RETRY_PAUSE" -- sudo apt-get install -y qemu-kvm nfs-kernel-server
sudo exportfs -v
sudo service nfs-kernel-server restart
# ====== Start VM =====================================================
sudo killall -q qemu-system-x86_64 || true
ssh-keygen -R "[localhost]:8829" -f ~/.ssh/known_hosts
# Non-KVM execution: qemu-system-x86_64 \
sudo qemu-system-x86_64 -machine type=pc,accel=kvm -nographic \
-m 6144 -cpu host -smp "$(nproc)" \
-drive "if=virtio,media=disk,file=/vservers/qemu-freebsd/$imageName,format=raw" \
-netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:8829-:22 -device virtio-net-pci,netdev=mynet0 \
-netdev tap,id=network0,ifname=tap0,script=no,downscript=no -device virtio-net-pci,netdev=network0,mac=00:00:00:00:00:00 \
&
ready=0
trials=20 ; sleep=15
i=0 ; while [ "$i" -lt "$trials" ]; do
# QA: Convert on POSIX compatible
# shellcheck disable=2219
let i=$i+1
echo "$i/$trials: Waiting for VM to boot ..."
sleep "$sleep"
if ssh -p 8829 -oStrictHostKeyChecking=no -i "$HOME/.ssh/id_rsa" root@localhost hostname; then
ready=1
break
fi
done
if [ $ready -eq 0 ]; then
echo >&2 "VM did not boot properly!"
exit 1
fi
# Download fuse-ufs2
# if [ ! -d fuse-ufs2/ ]; then
# info "Downloading fuse-ufs2 ..."
# git clone https://github.com/dreibh/fuse-ufs2 -b dreibh/ubuntu-disco-fix
# # git clone https://github.com/mkatiyar/fuse-ufs2
# fi
# Get repository
ssh -p 8829 -oStrictHostKeyChecking=no -i "$HOME/.ssh/id_rsa" root@localhost \
git clone https://github.com/Kreyrock/Kreyrock.git
unset imageName imageURL
fi
# MacOS X
elif [ "$TRAVIS_OS_NAME" = osx ]; then
# Nothing to be done here.
true
else
die "Invalid setting of TRAVIS_OS_NAME=$TRAVIS_OS_NAME, DOCKER=$DOCKER, QEMU=$QEMU!"
fi