diff --git a/scripts/classic b/scripts/classic deleted file mode 100755 index ab5ca89c2e43703162ebff97dfb6291dde39a964..0000000000000000000000000000000000000000 --- a/scripts/classic +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -set -e - -ROOT=$SNAP_COMMON/classic - -# $1: source -# $2: target -# $3: if not empty, bind mount will be read-only -# note that we do NOT clean these up at the end, as the user might start many -# classic shells in parallel; we could start all of them in their own mount -# namespace, but that would make the classic shell less useful for -# developing/debugging the snappy host -do_bindmount() { - if ! mountpoint -q "$ROOT/$2"; then - if [ -d "$1" -a ! -L "$1" ]; then - mkdir -p "$ROOT/$2" - fi - mount --make-rprivate --rbind -o rbind "$1" "$ROOT/$2" - if [ -n "${3:-}" ]; then - mount --rbind -o remount,ro "$1" "$ROOT/$2" - fi - fi -} - -if [ "$(id -u)" != "0" ]; then - echo "needs to run as root" - exit 1 -fi - -if [ ! -d $ROOT ]; then - # IMPORTANT: do not run the classic.create as this will run it with - # snap-confine again and this will cause havoc with current - # snap-confine - $SNAP/bin/create -fi - -# FIXME: confinement will prevent this -do_bindmount /home /home -do_bindmount /run /run -do_bindmount /proc /proc -do_bindmount /sys /sys -do_bindmount /dev /dev -do_bindmount / /snappy - -SUDO_USER=root - -# fix LP: #1619455 -cp -a /var/lib/extrausers/* $ROOT/var/lib/extrausers/ -cp -a /etc/sudoers.d/* $ROOT/etc/sudoers.d/ - -# assemble command line -DEVPTS="mount -o mode=666,ptmxmode=666 -t devpts devpts /dev/pts" -SUDOCMD="sudo debian_chroot=classic -u ${SUDO_USER} -i $@" -# FIXME: workaround for https://bugs.launchpad.net/snappy/+bug/1611493 -SCRIPT="script --quiet --return --command \"$SUDOCMD\" /dev/null" - -CMD="$DEVPTS; $SCRIPT" - -systemd-run --quiet --scope --unit=classic-$$.scope --description="Classic shell" chroot "$ROOT" sh -c "$CMD" - -# kill leftover processes after exiting, if it's still around -systemctl stop classic-$$.scope 2>/dev/null || true diff --git a/scripts/classic-create b/scripts/classic-create deleted file mode 100755 index 10b8efabad6305cda16fde5cb544e91d661b7fba..0000000000000000000000000000000000000000 --- a/scripts/classic-create +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -set -eu - -ROOT=$SNAP_COMMON/classic - -if [ -d $ROOT ]; then - echo "classic already enabled" - exit 1 -fi - -if [ $(id -u) -ne 0 ]; then - echo "This script needs to be called as root" >&2 - exit 1 -fi - -CORE="" -if [ -e /snap/core/current ]; then - CORE="core" -elif [ -e /snap/ubuntu-core/current ]; then - CORE="ubuntu-core" -else - echo "Cannot find core snap" - exit 1 -fi - -# FIXME: confinement will prevent this -echo "Creating classic environment" -VERSION="$(/bin/readlink /snap/${CORE}/current)" -SNAPROOT="/var/lib/snapd/snaps/${CORE}_${VERSION}.snap" -/usr/bin/unsquashfs -d $ROOT $SNAPROOT -mkdir $ROOT/snappy - -# enable -sudo chroot $ROOT /var/lib/classic/enable.sh - -# copy important config -for f in hostname timezone localtime; do - cp -a /etc/writable/$f $ROOT/etc/writable -done -for f in hosts; do - cp -a /etc/$f $ROOT/etc/ -done - - -# don't start services in the chroot on apt-get install -cat < "$ROOT/usr/sbin/policy-rc.d" -#!/bin/sh -while true; do - case "\$1" in - -*) shift ;; - makedev) exit 0;; - x11-common) exit 0;; - *) exit 101;; - esac -done -EOF -chmod 755 "$ROOT/usr/sbin/policy-rc.d" - -# workaround bug in livecd-rootfs -chmod 1777 "$ROOT/tmp" diff --git a/scripts/classic-reset b/scripts/classic-reset deleted file mode 100755 index 62c4329da48bc889dc5e4019268bcb4abdbc2e33..0000000000000000000000000000000000000000 --- a/scripts/classic-reset +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -set -eu - -ROOT=$SNAP_COMMON/classic - -if [ "$(id -u)" != "0" ]; then - echo "needs to run as root" - exit 1 -fi - -for d in /home /run /proc /sys /dev /var/lib/extrausers /etc/sudoers /etc/sudoers.d /snappy; do - if mountpoint -q "$ROOT/$d"; then - umount "$ROOT/$d" - fi -done - -# cleanup -rm -rf $ROOT diff --git a/snapcraft.yaml b/snapcraft.yaml index 76f49d78b66f61e6c1d58d13d957789fd1bd22b6..31f407ec77ae8a159017389ae9c468e3b241bd45 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -29,16 +29,10 @@ parts: scripts/snap-wrapper.sh: bin/anbox-wrapper.sh scripts/container-manager.sh: bin/container-manager.sh scripts/anbox-bridge.sh: bin/anbox-bridge.sh - scripts/classic: bin/classic - scripts/classic-create: bin/classic-create - scripts/classic-reset: bin/classic-reset snap: - bin/anbox-bridge.sh - bin/anbox-wrapper.sh - bin/container-manager.sh - - bin/classic - - bin/classic-create - - bin/classic-reset apparmor: plugin: nil stage-packages: