diff --git a/scripts/appimg-files/configure-host0.service b/scripts/appimg-files/configure-host0.service deleted file mode 100644 index b392001..0000000 --- a/scripts/appimg-files/configure-host0.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Run script to configure host0 interface -Before=network.target - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/libexec/configure-host0.sh - -[Install] -WantedBy=sysinit.target diff --git a/scripts/appimg-files/configure-host0.sh b/scripts/appimg-files/configure-host0.sh deleted file mode 100755 index 8ed8d57..0000000 --- a/scripts/appimg-files/configure-host0.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# inspired by last section of -# -# https://www.freedesktop.org/wiki/Software/systemd/ContainerInterface/ -# -SYSTEMD_ENV=$(xargs -a /proc/1/environ --null echo) - -process_var() { - case ${1} in - "IFCONFIG_IP") - echo "IP: ${2}" - ip addr add ${2} dev host0 - ip link set host0 up - ;; - "IFCONFIG_GW") - echo "GW: ${2}" - ip route add default via ${2} - ;; - esac -} - -for var in ${SYSTEMD_ENV}; do - IFS="=" read -a PAIR <<< ${var} - if [[ ${#PAIR[@]} -eq 2 ]]; then - process_var ${PAIR[0]} ${PAIR[1]} - fi -done diff --git a/scripts/build-user-rootfs-stage-one b/scripts/build-user-rootfs-stage-one deleted file mode 100755 index b30786a..0000000 --- a/scripts/build-user-rootfs-stage-one +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -DEBIAN_MIRROR="https://deb.debian.org/debian" -DEBIAN_RELEASE="buster" - -SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE})) -DBS_BASE=$(realpath ${SCRIPT_DIR}/../build/debootstrap) -DBS_ROOT=${DBS_BASE}/rootfs -CACHE_DIR=${DBS_BASE}/var-cache-apt-archives - - -run_debootstrap() { - [[ -d ${DBS_ROOT} ]] && rm -rf ${DBS_ROOT} - - [[ -f ${CACHE_DIR}/lock ]] && rm -f ${CACHE_DIR}/lock - mkdir -p ${CACHE_DIR} ${DBS_ROOT}/var/cache/apt/archives - mount --bind ${CACHE_DIR} ${DBS_ROOT}/var/cache/apt/archives - - debootstrap --verbose --merged-usr --variant=minbase \ - --include=systemd-sysv,locales \ - --exclude=sysv-rc,initscripts,startpar,lsb-base,insserv \ - ${DEBIAN_RELEASE} ${DBS_ROOT} ${DEBIAN_MIRROR} -} - -run_chroot_stage() { - mount chproc ${DBS_ROOT}/proc -t proc - mount chsys ${DBS_ROOT}/sys -t sysfs - - mkdir -p ${CACHE_DIR}/appimg-files - cp ${SCRIPT_DIR}/appimg-files/* ${CACHE_DIR}/appimg-files/ - - cp --preserve=mode ${SCRIPT_DIR}/build-user-rootfs-stage-two ${DBS_ROOT}/root/install.sh - - DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot ${DBS_ROOT} /root/install.sh ${DEBIAN_RELEASE} ${DEBIAN_MIRROR} - rm -f ${DBS_ROOT}/root/install.sh -} - - -cleanup_chroot() { - umount ${DBS_ROOT}/proc - umount ${DBS_ROOT}/sys - umount ${DBS_ROOT}/var/cache/apt/archives - rm -f ${DBS_ROOT}/var/cache/apt/pkgcache.bin - rm -f ${DBS_ROOT}/var/cache/apt/srcpkgcache.bin -} - -generate_tarball() { - printf "\n\n----- Generating rootfs tarball -----\n\n" - tar -C ${DBS_ROOT} --numeric-owner -c --xattrs --xattrs-include=* -f ${DBS_BASE}/user-rootfs.tar . - xz --force --threads=0 ${DBS_BASE}/user-rootfs.tar - ls -al ${DBS_BASE}/user-rootfs.tar - printf "\n\n" -} - - -run_debootstrap -run_chroot_stage -cleanup_chroot -generate_tarball diff --git a/scripts/build-user-rootfs-stage-two b/scripts/build-user-rootfs-stage-two deleted file mode 100755 index c20c044..0000000 --- a/scripts/build-user-rootfs-stage-two +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash - - -PACKAGES="man manpages vim less xz-utils sudo tmux dbus libpam-systemd vifm openssh-client gnome-terminal packagekit-gtk3-module libcanberra-gtk3-module libpulse0 firefox fonts-roboto-hinted nautilus eog evince unzip" - -# appimg-files are stored here because we're already bind mounting the parent directory -APPIMG_FILES="/var/cache/apt/archives/appimg-files" - -setup_locale() { - echo "en_US.UTF-8 UTF-8" > /etc/locale.gen - locale-gen - update-locale LANG=en_US.UTF-8 - export LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 -} - -configure_systemd() { - mkdir -p /etc/systemd/user.conf.d - printf '[Manager]\nDefaultEnvironment="DISPLAY=:0"\n' > /etc/systemd/user.conf.d/50-display-env.conf - - mkdir -p /etc/systemd/logind.conf.d - printf 'KillUserProcesses=no\n' > /etc/systemd/logind.conf.d/50-no-kill-user-processes.conf -} - -write_launch_script() { - mkdir -p /usr/libexec - cat > /usr/libexec/launch <<- 'EOF' -#!/bin/bash -export DISPLAY=:0 -export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus -export XDG_RUNTIME_DIR=/run/user/1000 -export PULSE_SERVER=unix:/run/user/host/pulse/native -export GNOME_DESKTOP_SESSION_ID=this-is-deprecated -$@ -EOF - chmod +x /usr/libexec/launch -} - -generate_apt_sources() { - echo "deb ${DEBIAN_MIRROR} ${DEBIAN_RELEASE} main contrib non-free" - echo "deb ${DEBIAN_MIRROR}-security ${DEBIAN_RELEASE}/updates main contrib non-free" - echo "deb ${DEBIAN_MIRROR} unstable main" -} - -setup_etc() { - printf "127.0.0.1\tsubgraph localhost\n" > /etc/hosts - echo "subgraph" > /etc/hostname - generate_apt_sources > /etc/apt/sources.list - echo 'APT::Install-Recommends "0";' > /etc/apt/apt.conf.d/99no-install-recommends - echo 'APT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/99no-install-recommends -} - -create_user() { - useradd -s /bin/bash -m user - echo "user:user" | chpasswd - usermod -aG sudo user - echo "export DISPLAY=:0" >> /home/user/.bashrc -} - -install_packages() { - apt-get update - apt-get --assume-yes upgrade - apt-get --assume-yes install ${PACKAGES} - - printf "\n\nInstalled Packages\n\n" - dpkg -l -} - -post_install_packages() { - # Otherwise gnome-terminal won't work if nothing else has been launched - # see 'enable-linger' in loginctl(1) - mkdir /var/lib/systemd/linger - touch /var/lib/systemd/linger/user - - install -m 0755 ${APPIMG_FILES}/configure-host0.sh /usr/libexec - install -m 0644 ${APPIMG_FILES}/configure-host0.service /usr/lib/systemd/system - systemctl enable configure-host0.service -} - -set -u -set -e - -DEBIAN_RELEASE=${1} -DEBIAN_MIRROR=${2} - -setup_locale -configure_systemd -write_launch_script -setup_etc -create_user -install_packages -post_install_packages