From 7c4b64f55375c3da3800431b02ea967b4d359da2 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 08 Apr 2016 18:05:32 -0400 Subject: cam1: New host --- (limited to 'hosts/cam1') diff --git a/hosts/cam1 b/hosts/cam1 new file mode 100644 index 0000000..5cfd0a3 --- /dev/null +++ b/hosts/cam1 @@ -0,0 +1,177 @@ +#!/bin/sh + +# start,size,id,bootable +part_script=' + ,+,83,* + ' + +# fs mp type options dump pass +fstab=' + @DEV1@ / ext4 errors=remount-ro 0 1 + /var/swap swap swap defaults,pri=100 0 0 + ' + +mirror='http://httpredir.debian.org/debian' +suite='stretch' +arch='amd64' +extra_pkgs=' + linux-image-amd64 + sysvinit-core + ' + +hostname='cam1' + +locale='en_US' +supported_locales='en_US.UTF-8 en_DK.UTF-8' + +time_zone='UTC' + +passwd_shadow='on' +root_passwd_crypted='$6$f65H32OqVRCio9qX$9HW5miPDXJkrfg3UXu6Yh5PmHq5ek0y29Qr4GMf38XRqmjvUOOJMqnQHVZAb8D2utTOyH0IDGHjglHfzuwmzU0' +root_login=true +user_make=true +user_name='cam' +user_full_name='CAM User' +user_groups='adm cdrom floppy sudo audio dip video plugdev netdev' +user_passwd_crypted='$6$f65H32OqVRCio9qX$9HW5miPDXJkrfg3UXu6Yh5PmHq5ek0y29Qr4GMf38XRqmjvUOOJMqnQHVZAb8D2utTOyH0IDGHjglHfzuwmzU0' + +debconf_selections=' + keyboard-configuration keyboard-configuration/layout select English (US) + keyboard-configuration keyboard-configuration/variant select English (US) + ' + +postinst_pkgs=' + bash bash-completion + screen sudo adduser + bc + nocache + vcsh myrepos + vim bvi less wdiff vbindiff + git gitk build-essential autoconf automake pkg-config m4 bison flex gdb + patch quilt + flashrom + cups printer-driver-hpcups system-config-printer + xorg xserver-xorg-video-intel xserver-xorg-input-evdev + xinput xserver-xorg-input-synaptics desktop-base x11-xserver-utils + xdg-utils avahi-daemon libnss-mdns anacron iw alsa-utils alsa-base + fluxbox fbpanel fbpager clipit compton + xdm xscreensaver scrot + gnome-themes-standard + roxterm-gtk3 gtk-redshift + gpicview gimp inkscape + librsvg2-bin xcftools imagemagick + openssh-server openssh-client rsync netcat-openbsd + openscad + slic3r printrun + evince + minicom htop ntp ncdu + wicd-daemon wicd-gtk wicd-curses wicd-cli + gnome-calculator units + fonts-mplus fonts-linuxlibertine fonts-freefont-ttf + fonts-dejavu fonts-liberation + fonts-droid fonts-ubuntu-title fonts-lato ttf-unifont + ' + +do_postinst() +{ + # Make swap file and set vm.swappiness. + # mkswap needs to be given the full path to the swap file including the + # root file system's mount point, or else this false error happens: + # mkswap: error: /var/swap is mounted; will not make swapspace + fallocate -l 4GiB "${target}/var/swap" || return 1 + chmod 0600 "${target}/var/swap" || return 1 + mkswap "${target}/var/swap" || return 1 + printf 'vm.swappiness = 10\n' \ + >"${target}/etc/sysctl.d/vm-swappiness.conf" + + # Add "deb-src" line. + cat >"${target}/etc/apt/sources.list" <<-EOF + deb http://httpredir.debian.org/debian stretch main + deb-src http://httpredir.debian.org/debian stretch main + EOF + in_target apt-get update || return 1 + + # 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 + + # Install Vertex themes. + in_target apt-get -q -y install gnome-themes-standard \ + gtk2-engines-murrine libgtk-3-dev + in_target sudo -u cam sh <<-EOF + set -e + git clone https://github.com/horst3180/vertex-theme \ + /home/cam/src/vertex-theme/ + cd /home/cam/src/vertex-theme/ + ./autogen.sh --prefix=/home/cam/.local + make install + ln -s .local/share/themes/ /home/cam/.themes + EOF + [ ${?} -ne 0 ] && return 1 + + # Download wallpaper. + in_target sudo -u cam wget -O /home/cam/.wallpaper \ + http://product-files.libiquity.com/taurinus/boot-splash/x200/background.png + + # Use temporary configuation SSH key. + install -d -o 1000 -g 1000 -m 0700 "${target}/home/cam/.ssh" || return 1 + cat >"${target}/home/cam/.ssh/id_rsa" <<-EOF + -----BEGIN RSA PRIVATE KEY----- + MIICXAIBAAKBgQCzAF0zqeS2X0TuVOIxqMec3lMzZy/MHQswPP+BQkmc2D3YVb2x + px1YAAweQnfZ27pGJkDztStOtMQJeaOsnAVdm2NSe+hEdaKAOxf9p6t+F930HM/w + 1wkm1ddlsnCaaCipzGVOM77Q/brEItWvuq8G0+/fgN1o4pZzl4Bub/4D4QIDAQAB + AoGAS+wKnAAiXuv3m7LrIa75w2JVHcdVcZicB0DICnYoLNtXF+v+AlzkSE/009zT + YtccoeZVxEiCbuajA3XRY0PlzgGHTbsGn1BWqI9cjdXTiotnjzOH8zr3JiMZMWwf + hqwbtleP+yruNPHMxQ8dKVXv875NKJW+aArmQWtjeMOy/vECQQDdsvPJ4bUu8M7/ + MXqGtz8CJbrRp+ZMKUw0WuwSwTfHRs/Jp27mWf5+t/u+RN8WK/RRD8FHvz4azLhr + sNUFiE69AkEAzrI/DFBFOM5mUECujs2UvCCeWZiAi9QoJ7kDrrAkcG+hMalpNUU3 + SUZ76stBUk3hZNpc82aq0a0o8ac0VrBd9QJAB3nbYrlrxLN2J4Dhot1XEJl5HUzO + JU9XNITEZTWCzgODSkeNI9NxE5DcumPUKgk9aeZgHC1EyN6ScX87D76y+QJAL8DE + ii69X1toDeBzs7BRTYlnrCFsiWGRiWPYMvKk6IkRv6x5DwKXvEkZdexRghdWHHvK + f71Xd6u+yt2rXN/QRQJBALv6SwbokdXp5qKJV48QG452dSOT7FQEINnCsIeNUKP6 + 9YyaZxqLia6pEbEKTSRdztXaMqRsrmOG8E084sFg8DQ= + -----END RSA PRIVATE KEY----- + EOF + in_target chown cam:cam '/home/cam/.ssh/id_rsa' + in_target chmod 0600 '/home/cam/.ssh/id_rsa' + + # Set up SSH known hosts. + cat >"${target}/home/cam/.ssh/known_hosts" <<-EOF + |1|fypb7kn7NH0fqHGj9Xs/rdpO71s=|SCtg2BdMNB9zL5bAPYkJy1uiNSM= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCXcG5BuZi4947D9WqY1L6CzaH4Qjw7YA7Dja+09y0nZjLVDd1saZCPkTjo1PEHxVCvSHvc0VmRqIZ2wUGtuqIlgGPMphCPAtdHN63YcNXqIhjEygLsaSZgy1Qz33YQF+YSANbeZQ4vnqiYr3C1IA7Cw4km/0s1BvP3t9yJf/iYODZqjVqUhqB4hzXJcBZHrgnM4LmPD4NH81fCqpwfRviNQNFAqd/aT1YTvgdn46HTVz7dV8ahW6SLXBTJZvO9dLAAKOPPZwuluaRphBqjPLC83zsihQ884SAH+AKcpN1ne73UZUuA1Gyk3HW+a/ngbzm1nmoeC0Sm1nNlTvC4WrLD + |1|z7it+otnWcn/98YKdeaBCXl+ug8=|NFRpdQZBMTAuWbUDAqXLptFR5Ao= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCXcG5BuZi4947D9WqY1L6CzaH4Qjw7YA7Dja+09y0nZjLVDd1saZCPkTjo1PEHxVCvSHvc0VmRqIZ2wUGtuqIlgGPMphCPAtdHN63YcNXqIhjEygLsaSZgy1Qz33YQF+YSANbeZQ4vnqiYr3C1IA7Cw4km/0s1BvP3t9yJf/iYODZqjVqUhqB4hzXJcBZHrgnM4LmPD4NH81fCqpwfRviNQNFAqd/aT1YTvgdn46HTVz7dV8ahW6SLXBTJZvO9dLAAKOPPZwuluaRphBqjPLC83zsihQ884SAH+AKcpN1ne73UZUuA1Gyk3HW+a/ngbzm1nmoeC0Sm1nNlTvC4WrLD + EOF + in_target chown cam:cam '/home/cam/.ssh/known_hosts' + in_target chmod 0600 '/home/cam/.ssh/known_hosts' + + # Bootstrap vcsh and mr. + rm -f "${target}/home/cam/.profile" "${target}/home/cam/.bashrc" \ + "${target}/home/cam/.bash_logout" + in_target sudo -u cam vcsh clone \ + ssh://git@git.pehjota.net/dotfiles/mr.git mr || return 1 + in_target sudo -u cam mr update || return 1 + in_target sudo -u cam /home/cam/bin/dfen clipit fluxbox \ + gpicview gimp gtk redshift roxterm \ + xdg-user-dirs xscreensaver + + # Create XDG directories. + sed 's/#.*$//; /^$/d;' "${target}/home/cam/.config/user-dirs.dirs" | \ + while IFS='=' read var val; do + eval "mkdir '${target}/home/cam/'${val}" + done + + # Generate target's SSH keypair. + #rm -f "${target}/home/cam/.ssh/id_rsa" \ + # "${target}/home/cam/.ssh/id_rsa.pub" || return 1 + #install -o 1000 -g 1000 -m 0600 '/home/pj/.ssh/id_rsa' \ + # "${target}/home/cam/.ssh/id_rsa" || return 1 + #install -o 1000 -g 1000 -m 0600 '/home/pj/.ssh/id_rsa.pub' \ + # "${target}/home/cam/.ssh/id_rsa.pub" || return 1 + #in_target ssh-keygen -b 4096 -C cam@cam1 -t rsa \ + # -f /home/cam/.ssh/id_rsa