Change how the VM initializes, to work in virtualbox

This commit is contained in:
Micah Lee 2021-08-17 13:44:52 -07:00
parent 1432ca75fc
commit 27a7f86641
7 changed files with 30 additions and 23 deletions

View file

@ -1,5 +1,7 @@
#!/bin/sh
ALPINE_TAG=v3.14.1
# Set up podman
sudo modprobe fuse
sudo modprobe tun
@ -32,13 +34,13 @@ chmod 777 /vagrant/vm
# Make the iso
cd ~/aports/scripts
sudo -u user sh mkimage.sh --tag v3.14.1 \
sudo -u user sh mkimage.sh --tag "$ALPINE_TAG" \
--outdir /vagrant/vm \
--arch x86_64 \
--repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main \
--repository http://dl-cdn.alpinelinux.org/alpine/v3.14/community \
--profile dangerzone
mv /vagrant/vm/alpine-dangerzone-v3.14-x86_64.iso /vagrant/vm/dangerzone.iso
mv /vagrant/vm/alpine-dangerzone-${ALPINE_TAG}-x86_64.iso /vagrant/vm/dangerzone.iso
# Fix permissions
chmod 755 /vagrant/vm

View file

@ -1,12 +0,0 @@
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n dangerzone"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname dangerzone
"
DNSOPTS="-d example.com 4.4.4.4"
TIMEZONEOPTS="-z UTC"
SSHDOPTS="-c openssh"

View file

@ -1,9 +1,26 @@
#!/sbin/openrc-run
name="Dangerzone init script"
start() {
# Setup Alpine
/sbin/setup-alpine -f /etc/answers.txt -e -q
rm /etc/answers.txt
# Hostname
echo "dangerzone" > /etc/hostname
echo "127.0.0.1 dangerzone" >> /etc/hosts
hostname dangerzone
# Networking
cat > /etc/network/interfaces << EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname dangerzone
EOF
setup-interfaces -a
echo -e "\n" | setup-dns 4.4.4.4
rc-service networking restart
# Timezone
setup-timezone -z UTC
# Create user
/usr/sbin/adduser -D -u 1001 user
@ -18,5 +35,5 @@ start() {
echo "user:100000:65536" >> /etc/subgid
# SSH reverse tunnel to host
/etc/ssh-to-host.py &
/etc/setup-ssh.py &
}

View file

@ -29,13 +29,13 @@ done
cp -r /home/user/.local/share/containers "$tmp"/etc/container-data
# Start cgroups, required by podman
rc_add cgroups boot
rc_add cgroups default
# Start dropbear (ssh server)
rc_add dropbear boot
rc_add dropbear default
# Initialize the dangerzone VM
rc_add dangerzone boot
rc_add dangerzone default
# Other init scripts
rc_add devfs sysinit

View file

@ -1,6 +1,6 @@
#!/bin/sh
VAGRANT_FILES=$(find /vagrant -type f | grep -v /vagrant/.vagrant | grep -v /vagrant/vm)
VAGRANT_FILES=$(find /vagrant -type f | grep -v /vagrant/.vagrant | grep -v /vagrant/vm | grep -v /vagrant/windows.sh)
DANGERZONE_CONVERTER_FILES=$(find /opt/dangerzone-converter -type f)
for FILE in $VAGRANT_FILES; do dos2unix $FILE; done

View file

@ -8,4 +8,4 @@ cd ..\..
REM Copy the ISO to resources
mkdir share\vm
cp install\vm-builder\vm\dangerzone.iso share\vm
copy install\vm-builder\vm\dangerzone.iso share\vm