2020-09-28 00:49:26 +09:00
|
|
|
#!/bin/bash
|
2021-03-21 19:03:29 +09:00
|
|
|
set -uex -o pipefail
|
2020-09-28 00:49:26 +09:00
|
|
|
|
2021-03-22 20:08:42 +09:00
|
|
|
if [ ! -v TIMEZONE ]; then
|
|
|
|
TIMEZONE=Asia/Tokyo
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -v CI ]; then
|
|
|
|
CI=false
|
|
|
|
fi
|
2020-09-28 00:49:26 +09:00
|
|
|
|
|
|
|
/debootstrap/debootstrap --second-stage
|
|
|
|
|
2021-02-20 04:29:49 +09:00
|
|
|
if [ "${CI}" == "true" ]; then
|
|
|
|
REPO=deb.debian.org
|
|
|
|
REPO_SECURITY=deb.debian.org
|
|
|
|
else
|
|
|
|
REPO=localhost:65432
|
|
|
|
REPO_SECURITY=localhost:65433
|
|
|
|
fi
|
|
|
|
|
2020-09-28 00:49:26 +09:00
|
|
|
cat <<EOF > /etc/apt/sources.list
|
2021-02-20 04:29:49 +09:00
|
|
|
deb http://${REPO}/debian buster main contrib non-free
|
|
|
|
deb-src http://${REPO}/debian buster main contrib non-free
|
|
|
|
deb http://${REPO}/debian buster-updates main contrib non-free
|
|
|
|
deb-src http://${REPO}/debian buster-updates main contrib non-free
|
|
|
|
deb http://${REPO_SECURITY}/debian-security buster/updates main contrib non-free
|
|
|
|
deb-src http://${REPO_SECURITY}/debian-security buster/updates main contrib non-free
|
2020-09-28 00:49:26 +09:00
|
|
|
EOF
|
|
|
|
|
|
|
|
cat <<EOF > /etc/apt/apt.conf.d/90-norecommend
|
|
|
|
APT::Install-Recommends "0";
|
|
|
|
APT::Install-Suggests "0";
|
|
|
|
EOF
|
|
|
|
|
|
|
|
apt update -y
|
|
|
|
apt install -y locales
|
|
|
|
|
|
|
|
echo "$TIMEZONE" > /etc/timezone && \
|
|
|
|
dpkg-reconfigure -f noninteractive tzdata && \
|
2021-03-22 20:08:42 +09:00
|
|
|
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
|
2020-09-28 00:49:26 +09:00
|
|
|
echo 'LANG="en_US.UTF-8"' > /etc/default/locale && \
|
|
|
|
dpkg-reconfigure -f noninteractive locales && \
|
|
|
|
update-locale LANG=en_US.UTF-8
|
|
|
|
|
|
|
|
echo "brain" > /etc/hostname
|
|
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
|
|
apt install -y dialog sudo \
|
|
|
|
libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev \
|
2021-03-22 20:12:24 +09:00
|
|
|
xserver-xorg xserver-xorg-video-fbdev xserver-xorg-dev xserver-xorg-input-evdev xinput-calibrator xorg-dev x11-apps xinit \
|
|
|
|
openbox obconf obmenu jwm \
|
2020-09-28 00:49:26 +09:00
|
|
|
weston xwayland \
|
|
|
|
bash tmux vim htop \
|
2021-03-22 20:12:24 +09:00
|
|
|
midori pcmanfm lxterminal xterm gnome-terminal fbterm uim-fep uim-anthy fonts-noto-cjk \
|
2021-04-05 03:13:24 +09:00
|
|
|
dbus udev alsa-utils usbutils iw fake-hwclock\
|
2021-03-22 20:12:24 +09:00
|
|
|
build-essential flex bison pkg-config autotools-dev libtool autoconf automake device-tree-compiler \
|
2020-10-27 19:27:27 +09:00
|
|
|
python3 python3-dev python3-setuptools python3-wheel python3-pip python3-smbus \
|
2021-03-22 20:12:24 +09:00
|
|
|
resolvconf net-tools ssh openssh-client avahi-daemon curl wget git
|
2020-09-28 00:49:26 +09:00
|
|
|
|
2021-04-05 03:13:24 +09:00
|
|
|
systemctl enable fake-hwclock
|
|
|
|
|
2021-03-22 20:13:07 +09:00
|
|
|
# Ly
|
|
|
|
apt install -y libpam0g-dev libxcb-xkb-dev
|
|
|
|
cd /
|
|
|
|
git clone https://github.com/nullgemm/ly.git
|
|
|
|
cd ly
|
|
|
|
make github
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
cd /
|
|
|
|
rm -r ly
|
|
|
|
systemctl enable ly
|
|
|
|
|
2021-03-22 20:14:04 +09:00
|
|
|
# Create editable xorg.conf.d
|
|
|
|
install -m 0777 -d /etc/X11/xorg.conf.d
|
|
|
|
|
2021-02-23 23:39:40 +09:00
|
|
|
# Fix Midori launch failure
|
|
|
|
sudo update-mime-database /usr/share/mime
|
|
|
|
|
2021-03-22 20:10:33 +09:00
|
|
|
# Setup users
|
|
|
|
adduser --gecos "" --disabled-password --home /home/user user
|
|
|
|
echo user:brain | chpasswd
|
|
|
|
echo "user ALL=(ALL:ALL) ALL" > /etc/sudoers.d/user
|
|
|
|
echo -e "127.0.1.1\tbrain" >> /etc/hosts
|
|
|
|
|
|
|
|
echo root:root | chpasswd
|
|
|
|
|
2021-03-22 20:13:07 +09:00
|
|
|
# Fix Xorg permission for non-root users
|
|
|
|
# https://unix.stackexchange.com/questions/315169/how-can-i-run-usr-bin-xorg-without-sudo
|
|
|
|
chown root:input /usr/lib/xorg/Xorg
|
|
|
|
chmod g+s /usr/lib/xorg/Xorg
|
|
|
|
usermod -a -G video user
|
|
|
|
|
2021-03-22 20:10:33 +09:00
|
|
|
# Allow root login via UART
|
|
|
|
cat <<EOF >> /etc/securetty
|
|
|
|
ttymxc0
|
|
|
|
EOF
|
|
|
|
|
2020-10-27 19:52:59 +09:00
|
|
|
# Get wild
|
|
|
|
cat <<EOF > /etc/apt/sources.list
|
2021-02-20 04:29:49 +09:00
|
|
|
deb http://deb.debian.org/debian buster main contrib non-free
|
|
|
|
deb-src http://deb.debian.org/debian buster main contrib non-free
|
|
|
|
deb http://deb.debian.org/debian buster-updates main contrib non-free
|
|
|
|
deb-src http://deb.debian.org/debian buster-updates main contrib non-free
|
|
|
|
deb http://deb.debian.org/debian-security buster/updates main contrib non-free
|
|
|
|
deb-src http://deb.debian.org/debian-security buster/updates main contrib non-free
|
2020-10-27 19:52:59 +09:00
|
|
|
EOF
|
|
|
|
|