From 8e23f0b00865e0287720be8e542fc1bf1775bec6 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 8 Aug 2015 05:11:17 +0200 Subject: [PATCH] Add server post-install config script. --- jessie_start_server.sh | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 jessie_start_server.sh diff --git a/jessie_start_server.sh b/jessie_start_server.sh new file mode 100755 index 0000000..67c7e6d --- /dev/null +++ b/jessie_start_server.sh @@ -0,0 +1,57 @@ +#!/bin/sh +set -x +set -e + +# Set root pw. +passwd + +# Post-installation reduction. (Answer "no" to GRUB question.) +dpkg-query -Wf '${Package} ${Priority}\n' | grep ' required' | sed 's/ required//' > list_white_unsorted +echo 'ifupdown' >> list_white_unsorted +echo 'isc-dhcp-client' >> list_white_unsorted +sort list_white_unsorted > list_white +dpkg-query -Wf '${Package}\n' > list_all_packages +sort list_all_packages > foo +mv foo list_all_packages +comm -3 list_all_packages list_white > list_black +apt-mark auto `cat list_black` +echo 'APT::AutoRemove::RecommendsImportant "false";' > /etc/apt/apt.conf.d/99mindeps +echo 'APT::AutoRemove::SuggestsImportant "false";' >> /etc/apt/apt.conf.d/99mindeps +DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove +rm list_all_packages list_white_unsorted list_white list_black +echo 'APT::Install-Recommends "false";' >> /etc/apt/apt.conf.d/99mindeps +echo 'APT::Install-Suggests "false";' >> /etc/apt/apt.conf.d/99mindeps + +# Set up manuals. +apt-get -y install man-db manpages less + +# Locale config. +apt-get -y install locales +echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen +locale-gen + +# Clone git repository. +apt-get -y install ca-certificates +apt-get -y install git +git clone http://github.com/plomlompom/config +config/symlink.sh + +# Add user. Remove old user's config/ if it exists. +useradd -m -s /bin/bash plom +rm -rf /home/plom/config +su - plom -c 'git clone http://github.com/plomlompom/config /home/plom/config' +su plom -c '/home/plom/config/symlink.sh' + +# Set up editor. +apt-get -y install vim +mkdir -p .vimbackups +su plom -c 'mkdir -p /home/plom/.vimbackups/' + +# Set up openssh-server. +apt-get -y install openssh-server + +# Clean up. +rm jessie_start_server.sh + +# Set password for user. +passwd plom -- 2.30.2