You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

138 lines
3.6 KiB

  1. #!/bin/bash
  2. if [ "$IN_CHROOT" != "1" ] ; then
  3. echo This is supposed to run inside the chroot, oops
  4. exit 1
  5. fi
  6. set -e
  7. set -x
  8. # Move stuff to the right places
  9. install -D -m 0644 files/nilmbuntu.png /usr/share/xfce4/backdrops/nilmbuntu.png
  10. install -D -m 0644 files/casper.conf /etc/casper.conf
  11. install -D -m 0644 files/hosts.nilm /etc/hosts.nilm
  12. # Copy hosts for now (although it will get overwritten at boot)
  13. cat /etc/hosts.nilm >> /etc/hosts
  14. # Upgrade packages
  15. apt update
  16. apt -y dist-upgrade
  17. apt -y --purge autoremove
  18. # Remove old kernels, and reinstall the latest one (to make sure
  19. # it's present in /boot)
  20. LATEST_KERNEL=$(ls --sort=version /lib/modules/ | tail -n 1)
  21. for VER in $(ls --sort=version /lib/modules/) ; do
  22. if [ $VER != $LATEST_KERNEL ] ; then
  23. apt -y --purge remove "linux-.*$VER"
  24. fi
  25. done
  26. apt -y --reinstall install linux-image-${LATEST_KERNEL}
  27. # Disable upgrade popups
  28. sed -i -s -e 's/Prompt=.*/Prompt=never/g' \
  29. /etc/update-manager/release-upgrades || true
  30. # Set up & install postfix for local mail delivery
  31. debconf-set-selections <<"EOF"
  32. postfix postfix/mailname string localdomain
  33. postfix postfix/main_mailer_type select Local only
  34. EOF
  35. apt -y install postfix
  36. # Required packages
  37. apt -y install \
  38. python3 \
  39. python3-venv \
  40. python3-pip \
  41. git \
  42. build-essential \
  43. apache2 \
  44. libapache2-mod-wsgi
  45. # Install other useful stuff
  46. apt -y install \
  47. adb \
  48. avrdude \
  49. curl \
  50. debconf-utils \
  51. devscripts \
  52. dfu-programmer \
  53. dlocate \
  54. emacs \
  55. emacs-goodies-el \
  56. esptool \
  57. firefox \
  58. flashrom \
  59. gddrescue \
  60. git \
  61. gnuplot \
  62. gparted \
  63. help2man \
  64. ipython3 \
  65. libnewlib-arm-none-eabi \
  66. libreoffice \
  67. libstdc++-arm-none-eabi-newlib \
  68. texlive \
  69. mailutils \
  70. moreutils \
  71. mutt \
  72. octave \
  73. octave-missing-functions \
  74. octave-signal \
  75. openocd \
  76. openssh-server \
  77. openssl \
  78. openvpn \
  79. screen \
  80. silversearcher-ag \
  81. tcpdump \
  82. zip
  83. # Install the packages required for en_US language support
  84. # This avoids a prompt and package download at first install
  85. apt -y install $(/usr/bin/check-language-support -l en_US)
  86. # Set up timezone to America/New_York for the live CD
  87. ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
  88. dpkg-reconfigure -f noninteractive tzdata
  89. # Put some default desktop shortcuts in place
  90. DESKTOP=/etc/skel/Desktop
  91. mkdir -p $DESKTOP
  92. cp /usr/share/applications/exo-terminal-emulator.desktop $DESKTOP || true
  93. cp /usr/share/applications/exo-web-browser.desktop $DESKTOP || true
  94. chmod +x $DESKTOP/*
  95. # Custom background image
  96. XML=/etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml
  97. BG=/usr/share/xfce4/backdrops/nilmbuntu.png
  98. apt -y install xmlstarlet
  99. xmlstarlet ed -L -u "//property[@name='image-path']/@value" -v "$BG" $XML
  100. xmlstarlet ed -L -u "//property[@name='image-style']/@value" -v "3" $XML
  101. # Make Firefox nicer
  102. install -D -m 0644 files/syspref.js /etc/firefox/syspref.js
  103. # Create NILM user. This should happen after anything that we put in
  104. # /etc/skel, since files get copied from there. Note that this user
  105. # is the same as what we have in the preseed file and casper.conf
  106. if ! getent passwd nilm ; then
  107. adduser --gecos "NILM User" --disabled-password nilm
  108. fi
  109. # Make sure locate databases are up-to-date
  110. /etc/cron.daily/mlocate
  111. /etc/cron.daily/dlocate
  112. # Make sure initramfs was regenerated with casper changes.
  113. # Manipulate some config files to avoid host stuff leaking through.
  114. echo 'RESUME=none' > /etc/initramfs-tools/conf.d/resume
  115. mv /etc/crypttab /etc/crypttab-old
  116. CASPER_GENERATE_UUID=1 update-initramfs -u
  117. rm /etc/initramfs-tools/conf.d/resume
  118. mv /etc/crypttab-old /etc/crypttab