Skip to content

Instantly share code, notes, and snippets.

@elbosso
Last active August 18, 2019 06:39
Show Gist options
  • Save elbosso/ffd2f4f17434aa4dc0327082157ffa6e to your computer and use it in GitHub Desktop.
Save elbosso/ffd2f4f17434aa4dc0327082157ffa6e to your computer and use it in GitHub Desktop.
A script to bootstrap a (LXC) gui container
#!/bin/bash
source config_bootstrap_gui_container.sh
# the file config_bootstrap_gui_container.sh should reside in the directory this script is in
# it should contain the statements for setting the following environment variables:
# CONTAINER_NAME=<container name for new container to be created>
# CONTAINER_USER=<user name for main user inside the new container - has sudoer rights!
# CONTAINER_NAMESERVER=<name server address - just leave it out if you dont need a custom one - but remember to also remove the customization of /etc/resolv.conf further down...>
# or you could just uncomment the above lines and adjust them to your liking and comment out the source statement
lxc-create -t download -n "$CONTAINER_NAME" -- -d ubuntu -r bionic -a amd64
# joe .local/share/lxc/"$CONTAINER_NAME"/config
lxc-start -n "$CONTAINER_NAME"
lxc-attach -n "$CONTAINER_NAME" -- sudo bash -c 'apt-get update&&apt-get upgrade -y && apt-get autoremove -y && apt-get clean'
lxc-attach -n "$CONTAINER_NAME" -- sudo apt-get -y install firefox chromium-browser joe screen conky openssh-server
lxc-attach -n "$CONTAINER_NAME" -- sudo apt-get -y install ubuntu-restricted-extras dnsutils xpra blackbox openbox fluxbox xserver-xephyr
lxc-attach -n "$CONTAINER_NAME" -- sudo apt-get -y install xterm software-properties-common terminology nemo
lxc-attach -n "$CONTAINER_NAME" -- sudo add-apt-repository --yes ppa:js-reynaud/kicad-5.1
lxc-attach -n "$CONTAINER_NAME" -- sudo apt-get update
lxc-attach -n "$CONTAINER_NAME" -- sudo apt-get -y install kicad kicad-libraries
lxc-attach -n "$CONTAINER_NAME" -- sudo userdel ubuntu
lxc-attach -n "$CONTAINER_NAME" -- sudo rm -rf /home/ubuntu
lxc-attach -n "$CONTAINER_NAME" -- sudo adduser "$CONTAINER_USER"
lxc-attach -n "$CONTAINER_NAME" -- sudo usermod -aG sudo "$CONTAINER_USER"
lxc-attach -n "$CONTAINER_NAME" -- sudo echo "allowed_users=anybody" >/etc/X11/Xwrapper.config
lxc-attach -n "$CONTAINER_NAME" -- sudo rm /etc/resolv.conf
lxc-attach -n "$CONTAINER_NAME" -- sudo echo -e "#nameserver 8.8.8.8 8.8.4.4\nnameserver $CONTAINER_NAMESERVER\nsearch fritz.box\n" >/etc/resolv.conf
#lxc-attach -n "$CONTAINER_NAME" --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment