home · contact · privacy
5d6f84ff478075061c3dd66e466d39d27077480d
[config] / jessie_start.sh
1 #!/bin/sh
2 set -x
3 set -e
4
5 # Post-installation reduction. (Answer "no" to GRUB question.)
6 dpkg-query -Wf '${Package} ${Priority}\n' | grep ' required' | sed 's/ required//' > list_white_unsorted 
7 echo 'ifupdown' >> list_white_unsorted 
8 echo 'isc-dhcp-client' >> list_white_unsorted
9 sort list_white_unsorted > list_white
10 dpkg-query -Wf '${Package}\n' > list_all_packages
11 sort list_all_packages > foo
12 mv foo list_all_packages
13 comm -3 list_all_packages list_white > list_black
14 apt-mark auto `cat list_black`
15 echo 'APT::AutoRemove::RecommendsImportant "false";' > /etc/apt/apt.conf.d/99mindeps
16 echo 'APT::AutoRemove::SuggestsImportant "false";' >> /etc/apt/apt.conf.d/99mindeps 
17 DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove
18 rm list_all_packages list_white_unsorted list_white list_black 
19 echo 'APT::Install-Recommends "false";' >> /etc/apt/apt.conf.d/99mindeps
20 echo 'APT::Install-Suggests "false";' >> /etc/apt/apt.conf.d/99mindeps
21
22 # Package management config, system upgrade.
23 echo 'deb http://ftp.debian.org/debian/ jessie main contrib non-free' > /etc/apt/sources.list
24 echo 'deb http://security.debian.org/ jessie/updates main contrib non-free' >> /etc/apt/sources.list
25 echo 'deb http://ftp.debian.org/debian/ jessie-updates main contrib non-free' >> /etc/apt/sources.list
26 dhclient eth0
27 apt-get update
28 apt-get -y dist-upgrade
29
30 # Power management as per <http://thinkwiki.de/TLP_-_Linux_Stromsparen>.
31 echo '' >> /etc/apt/sources.list
32 echo 'deb http://repo.linrunner.de/debian jessie main' >> /etc/apt/sources.list
33 apt-key adv --keyserver pool.sks-keyservers.net --recv-keys CD4E8809
34 apt-get update
35 apt-get -y install linux-headers-amd64 tlp tp-smapi-dkms
36 sed -i 's/^#START_CHARGE_THRESH_BAT0/START_CHARGE_THRESH_BAT0=10 #START_CHARGE_THRESH_BAT0/' /etc/default/tlp
37 sed -i 's/^#STOP_CHARGE_THRESH_BAT0/START_CHARGE_THRESH_BAT0=10 #STOP_CHARGE_THRESH_BAT0/' /etc/default/tlp
38 sed -i 's/^#DEVICES_TO_DISABLE_ON_STARTUP/DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan" #DEVICES_TO_DISABLE_ON_STARTUP/' /etc/default/tlp
39 tlp start
40
41 # Don't clear boot messages on start up.
42 sed -i 's/^TTYVTDisallocate=yes$/TTYVTDisallocate=no/g' /etc/systemd/system/getty.target.wants/getty\@tty1.service
43
44 # Console config.
45 DEBIAN_FRONTEND=nointeractive apt-get -y install locales console-setup
46 echo 'ACTIVE_CONSOLES="/dev/tty[1-6]"' > /etc/default/console-setup
47 echo 'CHARMAP="UTF-8"' >> /etc/default/console-setup
48 echo 'CODESET="Lat15"' >> /etc/default/console-setup
49 echo 'FONTFACE="TerminusBold"' >> /etc/default/console-setup
50 echo 'FONTSIZE="8x16"' >> /etc/default/console-setup
51 echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
52 locale-gen
53 echo 'export LC_ALL="en_US.UTF-8"' >> /etc/profile
54
55 # Clone git repository.
56 apt-get -y install ca-certificates
57 apt-get -y install git
58 git clone http://github.com/plomlompom/config
59 config/symlink.sh
60
61 # Add user. Remove old user's config/ if it exists.
62 useradd -m -s /bin/bash plom
63 rm -rf /home/plom/config
64 su - plom -c 'git clone http://github.com/plomlompom/config /home/plom/config'
65 su plom -c /home/plom/config/symlink.sh
66
67 # Set up window system.
68 apt-get -y install xserver-xorg xinit xterm i3 i3status dmenu
69
70 # Set up manuals.
71 apt-get -y install man-db manpages less
72
73 # Set up editor.
74 apt-get -y install vim
75 mkdir -p .vimbackups
76 su plom -c 'mkdir -p /home/plom/.vimbackups/'
77
78 # Set up pentadactyl. 
79 apt-get -y install xul-ext-pentadactyl
80
81 # Clean up.
82 rm jessie_start.sh
83
84 # Set password for user.
85 passwd plom