diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2021-10-14 17:07:18 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2021-10-14 17:07:18 (EDT) |
commit | 813449a16aedba5d169bf124e9afbcbd60d40842 (patch) | |
tree | 63209cd07e8f74b4c69facaea9aeddfcded600ca /hosts/print1/postinst | |
parent | 945560d426165653772cfe37e62e61a78285bed6 (diff) | |
download | pc-inst-813449a16aedba5d169bf124e9afbcbd60d40842.zip pc-inst-813449a16aedba5d169bf124e9afbcbd60d40842.tar.gz pc-inst-813449a16aedba5d169bf124e9afbcbd60d40842.tar.bz2 |
print1: New host (copied from nas1)
Diffstat (limited to 'hosts/print1/postinst')
-rw-r--r-- | hosts/print1/postinst | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/hosts/print1/postinst b/hosts/print1/postinst new file mode 100644 index 0000000..deb9438 --- /dev/null +++ b/hosts/print1/postinst @@ -0,0 +1,47 @@ +#!/bin/sh + +# Purge systemd. +in_target apt-get -q -y purge libpam-systemd systemd || return 1 +in_target apt-get -q -y --purge autoremove || return 1 + +# Remove packages from APT cache. +in_target apt-get clean || return 1 + +# Fix booting and install GRUB. +mv "${target}/etc/default/grub" "${target}/etc/default/grub.dist" +sed \ + -e '^s/\(GRUB_CMDLINE_LINUX=".*\)"$/\1nomodeset"/' + "${target}/etc/default/grub.dist" 1>"${target}/etc/default/grub" +in_target update-grub +in_target grub-install "${dev}" + +# Update initramfs. +in_target update-initramfs -u + +# Configure network interfaces. +mv "${target}/etc/network/interfaces" "${target}/etc/network/interfaces.dist" +cat 1>"${target}/etc/network/interfaces" 0<<-EOF + auto lo + iface lo inet loopback + + auto enp1s0 + iface enp1s0 inet dhcp + EOF + +# Create mount point. +mkdir "${target}/media/5tb" + +# Configure NFS. +mv "${target}/etc/exports" "${target}/etc/exports.dist" +cat 1>"${target}/etc/exports" 0<<-EOF + /media/5tb 192.168.10.0/255.255.255.0(rw,sync,no_subtree_check,no_root_squash,mountpoint) + EOF + +# Harden SSH server. +mv "${target}/etc/ssh/sshd_config" "${target}/etc/ssh/sshd_config.dist" +sed \ + -e 's/^PermitRootLogin .*$/PermitRootLogin no/' \ + -e 's/^#PasswordAuthentication .*$/#PasswordAuthentication no/' \ + "${target}/etc/ssh/sshd_config.dist" 1>"${target}/etc/ssh/sshd_config" + +return 0 |