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 #!/bin/sh
ALPINE_TAG=v3.14.1
# Set up podman # Set up podman
sudo modprobe fuse sudo modprobe fuse
sudo modprobe tun sudo modprobe tun
@ -32,13 +34,13 @@ chmod 777 /vagrant/vm
# Make the iso # Make the iso
cd ~/aports/scripts 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 \ --outdir /vagrant/vm \
--arch x86_64 \ --arch x86_64 \
--repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main \ --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main \
--repository http://dl-cdn.alpinelinux.org/alpine/v3.14/community \ --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/community \
--profile dangerzone --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 # Fix permissions
chmod 755 /vagrant/vm 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 #!/sbin/openrc-run
name="Dangerzone init script" name="Dangerzone init script"
start() { start() {
# Setup Alpine # Hostname
/sbin/setup-alpine -f /etc/answers.txt -e -q echo "dangerzone" > /etc/hostname
rm /etc/answers.txt 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 # Create user
/usr/sbin/adduser -D -u 1001 user /usr/sbin/adduser -D -u 1001 user
@ -18,5 +35,5 @@ start() {
echo "user:100000:65536" >> /etc/subgid echo "user:100000:65536" >> /etc/subgid
# SSH reverse tunnel to host # 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 cp -r /home/user/.local/share/containers "$tmp"/etc/container-data
# Start cgroups, required by podman # Start cgroups, required by podman
rc_add cgroups boot rc_add cgroups default
# Start dropbear (ssh server) # Start dropbear (ssh server)
rc_add dropbear boot rc_add dropbear default
# Initialize the dangerzone VM # Initialize the dangerzone VM
rc_add dangerzone boot rc_add dangerzone default
# Other init scripts # Other init scripts
rc_add devfs sysinit rc_add devfs sysinit

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/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) DANGERZONE_CONVERTER_FILES=$(find /opt/dangerzone-converter -type f)
for FILE in $VAGRANT_FILES; do dos2unix $FILE; done for FILE in $VAGRANT_FILES; do dos2unix $FILE; done

View file

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