2018-02-05 04:02:09 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-20 17:19:19 +00:00
|
|
|
|
2018-02-21 01:17:45 +00:00
|
|
|
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"
|
2018-02-05 04:02:09 +00:00
|
|
|
|
2018-02-20 17:19:19 +00:00
|
|
|
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
|
2018-02-26 14:10:25 +00:00
|
|
|
export GNOME_DESKTOP_SESSION_ID=this-is-deprecated
|
2018-02-20 17:19:19 +00:00
|
|
|
$@
|
2018-02-05 16:18:21 +00:00
|
|
|
EOF
|
2018-02-20 17:19:19 +00:00
|
|
|
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
|
2018-02-20 17:46:40 +00:00
|
|
|
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
|
2018-02-20 17:19:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2018-02-20 17:46:40 +00:00
|
|
|
apt-get --assume-yes install ${PACKAGES}
|
2018-02-20 17:19:19 +00:00
|
|
|
|
|
|
|
printf "\n\nInstalled Packages\n\n"
|
|
|
|
dpkg -l
|
|
|
|
}
|
|
|
|
|
2018-02-21 00:59:28 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2018-02-20 17:19:19 +00:00
|
|
|
set -u
|
|
|
|
set -e
|
|
|
|
|
|
|
|
DEBIAN_RELEASE=${1}
|
|
|
|
DEBIAN_MIRROR=${2}
|
|
|
|
|
|
|
|
setup_locale
|
|
|
|
configure_systemd
|
|
|
|
write_launch_script
|
|
|
|
setup_etc
|
|
|
|
create_user
|
|
|
|
install_packages
|