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.
 
 
 

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