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.
 
 
 

136 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. gnuplot \
  61. help2man \
  62. ipython3 \
  63. libnewlib-arm-none-eabi \
  64. libreoffice \
  65. libstdc++-arm-none-eabi-newlib \
  66. texlive \
  67. mailutils \
  68. moreutils \
  69. mutt \
  70. octave \
  71. octave-missing-functions \
  72. octave-signal \
  73. openocd \
  74. openssh-server \
  75. openssl \
  76. openvpn \
  77. screen \
  78. silversearcher-ag \
  79. tcpdump \
  80. zip
  81. # Install the packages required for en_US language support
  82. # This avoids a prompt and package download at first install
  83. apt -y install $(/usr/bin/check-language-support -l en_US)
  84. # Set up timezone to America/New_York for the live CD
  85. ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
  86. dpkg-reconfigure -f noninteractive tzdata
  87. # Put some default desktop shortcuts in place
  88. DESKTOP=/etc/skel/Desktop
  89. mkdir -p $DESKTOP
  90. cp /usr/share/applications/exo-terminal-emulator.desktop $DESKTOP || true
  91. cp /usr/share/applications/exo-web-browser.desktop $DESKTOP || true
  92. chmod +x $DESKTOP/*
  93. # Custom background image
  94. XML=/etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml
  95. BG=/usr/share/xfce4/backdrops/nilmbuntu.png
  96. apt -y install xmlstarlet
  97. xmlstarlet ed -L -u "//property[@name='image-path']/@value" -v "$BG" $XML
  98. xmlstarlet ed -L -u "//property[@name='image-style']/@value" -v "3" $XML
  99. # Make Firefox nicer
  100. install -D -m 0644 files/syspref.js /etc/hosts.nilm
  101. # Create NILM user. This should happen after anything that we put in
  102. # /etc/skel, since files get copied from there. Note that this user
  103. # is the same as what we have in the preseed file and casper.conf
  104. if ! getent passwd nilm ; then
  105. adduser --gecos "NILM User" --disabled-password nilm
  106. fi
  107. # Make sure locate databases are up-to-date
  108. /etc/cron.daily/mlocate
  109. /etc/cron.daily/dlocate
  110. # Make sure initramfs was regenerated with casper changes.
  111. # Manipulate some config files to avoid host stuff leaking through.
  112. echo 'RESUME=none' > /etc/initramfs-tools/conf.d/resume
  113. mv /etc/crypttab /etc/crypttab-old
  114. CASPER_GENERATE_UUID=1 update-initramfs -u
  115. rm /etc/initramfs-tools/conf.d/resume
  116. mv /etc/crypttab-old /etc/crypttab