Skip to content

WIP for adding optional etc configurations and mount using drive UID #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
*.swp
.DS_store
*.img
*.dir
mnt
*.tar

1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ FROM amd64/debian:bullseye
LABEL com.iximiuz-project="docker-to-linux"
RUN apt-get -y update
RUN apt-get -y install extlinux fdisk

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ alpine.img:

linux.tar:
@echo ${COL_GRN}"[Dump ${DISTR} directory structure to tar archive]"${COL_END}
docker build -f ${DISTR}/Dockerfile -t ${REPO}/${DISTR} .
docker build -f ${DISTR}/Dockerfile -t ${REPO}/${DISTR} ${DISTR}
docker export -o linux.tar `docker run -d ${REPO}/${DISTR} /bin/true`

linux.dir: linux.tar
Expand Down
9 changes: 9 additions & 0 deletions PLAYBOOK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```bash
make debian # or ubuntu, or alpine

bash start-qemu.sh

mount -o remount,rw /

make clean
```
2 changes: 1 addition & 1 deletion alpine/syslinux.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ DEFAULT linux
SAY Now booting the kernel from SYSLINUX...
LABEL linux
KERNEL /boot/vmlinuz-virt
APPEND ro root=/dev/sda1 rootfstype=ext3 initrd=/boot/initramfs-virt
APPEND ro root=/dev/sda1 rootfstype=ext4 initrd=/boot/initramfs-virt

9 changes: 7 additions & 2 deletions create_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ dd if=/dev/zero of=/os/linux.img bs=$(expr 1024 \* 1024 \* 1024) count=1
echo -e "\n[Make partition]"
sfdisk /os/linux.img < /os/partition.txt

echo -e "\n[Format partition with ext3]"
echo -e "\n[Format partition with ext4]"
losetup -D

LOOPDEVICE=$(losetup -f)
echo -e "\n[Using ${LOOPDEVICE} loop device]"
losetup -o $(expr 512 \* 2048) ${LOOPDEVICE} /os/linux.img
mkfs.ext3 ${LOOPDEVICE}
mkfs.ext4 ${LOOPDEVICE}

echo -e "\n[Copy linux directory structure to partition]"
mkdir -p /os/mnt
Expand All @@ -24,6 +24,11 @@ cp -R /os/linux.dir/. /os/mnt/
echo -e "\n[Setup extlinux]"
extlinux --install /os/mnt/boot/
cp /os/${DISTR}/syslinux.cfg /os/mnt/boot/syslinux.cfg
echo " APPEND root=UUID=$(blkid -o value -s UUID | tail -2 | head -1) initrd=/initrd.img rw nosplash text biosdevname=0 net.ifnames=0 console=tty0 console=ttyS0,115200 earlyprintk=ttyS0,115200 consoleblank=0 systemd.show_status=true" >> /os/mnt/boot/syslinux.cfg
cat /os/mnt/boot/syslinux.cfg
echo "UUID=$(blkid -o value -s UUID | tail -2 | head -1) /dev/sda1 ext4 errors=remount-ro 0 1" >> /os/mnt/etc/fstab
# echo "LABEL=linux / ext4 defaults 0 0" >> /os/mnt/etc/fstab
# echo "BOOT_IMAGE=/vmlinuz root=LABEL=cloudimg-rootfs ro console=tty1 console=ttyS0" >> /os/mnt/proc/cmdline

echo -e "\n[Unmount]"
umount /os/mnt
Expand Down
27 changes: 25 additions & 2 deletions debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
FROM amd64/debian:bullseye
FROM amd64/debian:buster
LABEL com.iximiuz-project="docker-to-linux"
RUN apt-get -y update
RUN apt-get -y install --no-install-recommends \
# base
linux-image-amd64 \
systemd-sysv
systemd \
systemd-sysv \
\
# install networking
cloud-init \
ethtool \
ntp \
isc-dhcp-client \
\
# ssh
openssh-server \
\
# developer tools
vim \
aptitude \
cron \
iputils-ping \
man \
less \
curl

COPY ./etc/. /etc/

RUN echo "root:root" | chpasswd

34 changes: 34 additions & 0 deletions debian/Dockerfile.bridge
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM amd64/debian:buster
LABEL com.iximiuz-project="docker-to-linux"
RUN apt-get -y update
RUN apt-get -y install --no-install-recommends \
# base
linux-image-amd64 \
systemd \
systemd-sysv \
\
# install networking
cloud-init \
ethtool \
ntp \
isc-dhcp-client \
\
# ssh
openssh-server \
\
# developer tools
vim \
aptitude \
cron \
iputils-ping \
man \
less \
curl \
# bridge
bridge-utils

COPY ./etc/. /etc/
# COPY ./etc-bridge/. /etc/

RUN echo "root:root" | chpasswd

11 changes: 11 additions & 0 deletions debian/etc-bridge/networks/interfaces.d/br0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
auto br0
iface br0 inet dhcp
pre-up ip tuntap add dev tap0 mode tap user root
pre-up ip link set tap0 up
bridge_ports all tap0
# bridge_ports eno1
bridge_stp off
bridge_maxwait 0
bridge_fd 0
post-down ip link set tap0 down
post-down ip tuntap del dev tap0 mode tap
54 changes: 54 additions & 0 deletions debian/etc/dhcp/dhclient.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Configuration file for /sbin/dhclient.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
# man page for more information about the syntax of this file
# and a more comprehensive list of the parameters understood by
# dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
# not leave anything out (like the domain name, for example), then
# few changes must be made to this file, if any.
#

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;

#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
#require subnet-mask, domain-name-servers;
#timeout 60;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/sbin/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;

#alias {
# interface "eth0";
# fixed-address 192.5.5.213;
# option subnet-mask 255.255.255.255;
#}

#lease {
# interface "eth0";
# fixed-address 192.33.137.200;
# medium "link0 link1";
# option host-name "andare.swiftmedia.com";
# option subnet-mask 255.255.255.0;
# option broadcast-address 192.33.137.255;
# option routers 192.33.137.250;
# option domain-name-servers 127.0.0.1;
# renew 2 2000/1/12 00:00:01;
# rebind 2 2000/1/12 00:00:01;
# expire 2 2000/1/12 00:00:01;
#}
Empty file added debian/etc/fstab
Empty file.
1 change: 1 addition & 0 deletions debian/etc/hostname
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terna
10 changes: 10 additions & 0 deletions debian/etc/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
127.0.1.1 terna
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
16 changes: 16 additions & 0 deletions debian/etc/network/if-down.d/resolvconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
#
# ifdown hook script for resolvconf
#
# This file is part of the resolvconf package.
#

[ -x /sbin/resolvconf ] || exit 0

case "$ADDRFAM" in
inet|inet6) : ;;
*) exit 0 ;;
esac

/sbin/resolvconf -d "${IFACE}.${ADDRFAM}" || :

47 changes: 47 additions & 0 deletions debian/etc/network/if-up.d/000resolvconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/sh
#
# ifup hook script for resolvconf
#
# This file is part of the resolvconf package.
#

[ -x /sbin/resolvconf ] || exit 0

case "$ADDRFAM" in
inet|inet6) : ;;
*) exit 0 ;;
esac

R=""
if [ "$IF_DNS_DOMAIN" ] ; then
R="${R}domain $IF_DNS_DOMAIN
"
fi
if [ "$IF_DNS_SEARCH" ] ; then
R="${R}search $IF_DNS_SEARCH
"
fi
if [ "$IF_DNS_SORTLIST" ] ; then
R="${R}sortlist $IF_DNS_SORTLIST
"
fi
for NS in $IF_DNS_NAMESERVERS ; do
R="${R}nameserver $NS
"
done

# Note: arguments of multiple instances of options are separated by newlines
set_NS_to_first_arg() { NS="$1" ; }
STANDARD_IFS="$IFS"
IFS='
'
for OPT in $IF_DNS_NAMESERVER ; do
IFS="$STANDARD_IFS"
set_NS_to_first_arg $OPT
[ "$NS" ] && R="${R}nameserver $NS
"
done
IFS="$STANDARD_IFS"

echo -n "$R" | /sbin/resolvconf -a "${IFACE}.${ADDRFAM}" || :

8 changes: 8 additions & 0 deletions debian/etc/network/interfaces
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback
4 changes: 4 additions & 0 deletions debian/etc/networks
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default 0.0.0.0
loopback 127.0.0.0
link-local 169.254.0.0

52 changes: 52 additions & 0 deletions debian/etc/ssh/ssh_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

Host *
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Protocol 2
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,[email protected]
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
# PermitRootLogin yes
Loading