|
- #!/bin/bash
-
- if [ "$IN_CHROOT" != "1" ] ; then
- echo This is supposed to run inside the chroot, oops
- exit 1
- fi
-
- set -e
- set -x
-
- # Move stuff to the right places
- install -D -m 0644 files/nilmbuntu.png /usr/share/xfce4/backdrops/nilmbuntu.png
- install -D -m 0644 files/fallback_dns.conf /etc/systemd/resolved.conf.d/fallback_dns.conf
- install -D -m 0644 files/casper.conf /etc/casper.conf
- install -D -m 0644 files/hosts.nilm /etc/hosts.nilm
-
- # Copy hosts for now (although it will get overwritten at boot)
- cat /etc/hosts.nilm >> /etc/hosts
-
- # Upgrade packages
- apt update
- apt -y dist-upgrade
- apt -y --purge autoremove
-
- # Remove old kernels, and reinstall the latest one (to make sure
- # it's present in /boot)
- LATEST_KERNEL=$(ls --sort=version /lib/modules/ | tail -n 1)
- for VER in $(ls --sort=version /lib/modules/) ; do
- if [ $VER != $LATEST_KERNEL ] ; then
- apt -y --purge remove "linux-.*$VER"
- fi
- done
- apt -y --reinstall install linux-image-${LATEST_KERNEL}
-
- # Disable upgrade popups
- sed -i -s -e 's/Prompt=.*/Prompt=never/g' \
- /etc/update-manager/release-upgrades || true
-
- # Set up & install postfix for local mail delivery
- debconf-set-selections <<"EOF"
- postfix postfix/mailname string localdomain
- postfix postfix/main_mailer_type select Local only
- EOF
- apt -y install postfix
-
- # Required packages
- apt -y install \
- python3 \
- python3-pip \
- git \
- build-essential \
- apache2 \
- libapache2-mod-wsgi
-
- # Install other useful stuff
- apt -y install \
- adb \
- avrdude \
- curl \
- debconf-utils \
- devscripts \
- dfu-programmer \
- dlocate \
- emacs \
- emacs-goodies-el \
- esptool \
- firefox \
- flashrom \
- gddrescue \
- gnuplot \
- help2man \
- ipython3 \
- libnewlib-arm-none-eabi \
- libreoffice \
- libstdc++-arm-none-eabi-newlib \
- texlive \
- mailutils \
- moreutils \
- mutt \
- octave \
- octave-missing-functions \
- octave-signal \
- openocd \
- openssh-server \
- openssl \
- openvpn \
- screen \
- silversearcher-ag \
- tcpdump \
- zip
-
- # Install the packages required for en_US language support
- # This avoids a prompt and package download at first install
- apt -y install $(/usr/bin/check-language-support -l en_US)
-
- # Set up timezone to America/New_York for the live CD
- ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
- dpkg-reconfigure -f noninteractive tzdata
-
- # Put some default desktop shortcuts in place
- DESKTOP=/etc/skel/Desktop
- mkdir -p $DESKTOP
- cp /usr/share/applications/exo-terminal-emulator.desktop $DESKTOP || true
- cp /usr/share/applications/exo-web-browser.desktop $DESKTOP || true
- chmod +x $DESKTOP/*
-
- # Custom background image
- XML=/etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml
- BG=/usr/share/xfce4/backdrops/nilmbuntu.png
- apt -y install xmlstarlet
- xmlstarlet ed -L -u "//property[@name='image-path']/@value" -v "$BG" $XML
- xmlstarlet ed -L -u "//property[@name='image-style']/@value" -v "3" $XML
-
- # Make Firefox nicer
- install -D -m 0644 files/syspref.js /etc/hosts.nilm
-
- # Create NILM user. This should happen after anything that we put in
- # /etc/skel, since files get copied from there. Note that this user
- # is the same as what we have in the preseed file and casper.conf
- if ! getent passwd nilm ; then
- adduser --gecos "NILM User" --disabled-password nilm
- fi
-
- # Make sure locate databases are up-to-date
- /etc/cron.daily/mlocate
- /etc/cron.daily/dlocate
-
- # Make sure initramfs was regenerated with casper changes.
- # Manipulate some config files to avoid host stuff leaking through.
- echo 'RESUME=none' > /etc/initramfs-tools/conf.d/resume
- mv /etc/crypttab /etc/crypttab-old
- CASPER_GENERATE_UUID=1 update-initramfs -u
- rm /etc/initramfs-tools/conf.d/resume
- mv /etc/crypttab-old /etc/crypttab
|