home · contact · privacy
Export vim as default shell editor.
[config] / jessie_start_thinkpad.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 echo 'deb http://ftp.debian.org/debian/ testing main contrib non-free' >> /etc/apt/sources.list
27 echo 'deb http://security.debian.org/ testing/updates main contrib non-free' >> /etc/apt/sources.list
28 echo 'deb http://ftp.debian.org/debian/ testing-updates main contrib non-free' >> /etc/apt/sources.list
29 echo 'APT::Default-Release "stable"' >> /etc/apt/apt.conf.d/99defaultrelease
30 dhclient eth0
31 apt-get update
32 apt-get -y dist-upgrade
33
34 # Set up manuals.
35 apt-get -y install man-db manpages less
36
37 # Power management as per <http://thinkwiki.de/TLP_-_Linux_Stromsparen>.
38 echo '' >> /etc/apt/sources.list
39 echo 'deb http://repo.linrunner.de/debian jessie main' >> /etc/apt/sources.list
40 apt-key adv --keyserver pool.sks-keyservers.net --recv-keys CD4E8809
41 apt-get update
42 apt-get -y install linux-headers-amd64 tlp tp-smapi-dkms
43 sed -i 's/^#START_CHARGE_THRESH_BAT0/START_CHARGE_THRESH_BAT0=10 #START_CHARGE_THRESH_BAT0/' /etc/default/tlp
44 sed -i 's/^#STOP_CHARGE_THRESH_BAT0/STOP_CHARGE_THRESH_BAT0=95 #STOP_CHARGE_THRESH_BAT0/' /etc/default/tlp
45 sed -i 's/^#DEVICES_TO_DISABLE_ON_STARTUP/DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan" #DEVICES_TO_DISABLE_ON_STARTUP/' /etc/default/tlp
46 tlp start
47
48 # Don't clear boot messages on start up.
49 sed -i 's/^TTYVTDisallocate=yes$/TTYVTDisallocate=no/g' /etc/systemd/system/getty.target.wants/getty\@tty1.service
50
51 # Set up timezone.
52 echo 'Europe/Berlin' > /etc/timezone
53 cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime
54
55 # Console config.
56 DEBIAN_FRONTEND=nointeractive apt-get -y install locales console-setup
57 echo 'ACTIVE_CONSOLES="/dev/tty[1-6]"' > /etc/default/console-setup
58 echo 'CHARMAP="UTF-8"' >> /etc/default/console-setup
59 echo 'CODESET="Lat15"' >> /etc/default/console-setup
60 echo 'FONTFACE="TerminusBold"' >> /etc/default/console-setup
61 echo 'FONTSIZE="8x16"' >> /etc/default/console-setup
62 echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
63 locale-gen
64 echo 'export LC_ALL="en_US.UTF-8"' >> /etc/profile
65 sed -i 's/^XKBLAYOUT/XKBLAYOUT="de" # XKBLAYOUT/g' /etc/default/keyboard
66 service keyboard-setup restart
67
68 # Clone git repository.
69 apt-get -y install ca-certificates
70 apt-get -y install git
71 git clone http://github.com/plomlompom/config
72 config/symlink.sh
73
74 # Add user. Remove old user's config/ if it exists.
75 useradd -m -s /bin/bash plom
76 rm -rf /home/plom/config
77 su - plom -c 'git clone http://github.com/plomlompom/config /home/plom/config'
78 su plom -c '/home/plom/config/symlink.sh thinkpad'
79
80 # Set up editor.
81 apt-get -y install vim
82 mkdir -p .vimbackups
83 su plom -c 'mkdir -p /home/plom/.vimbackups/'
84
85 # Set up networking (wifi!).
86 apt-get -y install firmware-iwlwifi
87 DEBIAN_FRONTEND=noninteractive apt-get -y install wicd-curses
88 sed -i 's/^wired_interface = .*$/wired_interface = eth0/g' /etc/wicd/manager-settings.conf
89 sed -i 's/^wireless_interface = .*$/wireless_interface = wlan0/g' /etc/wicd/manager-settings.conf
90 systemctl restart wicd
91
92 # Set up hibernation on lid close.
93 echo 'HandleLidSwitch=hibernate' >> /etc/systemd/logind.conf
94
95 # Set up sound.
96 usermod -aG audio plom
97 apt-get -y install alsa-utils
98 amixer -c 0 sset Master playback 100% unmute
99
100 # Set up window system and OpenGL.
101 apt-get -y install xserver-xorg xinit xterm i3 i3status dmenu
102
103 # Set up OpenGL and hardware acceleration.
104 apt-get -y install libgl1-mesa-dri
105 apt-get -y install i965-va-driver
106 usermod -aG video plom
107
108 # Install xrandr.
109 apt-get -y install x11-xserver-utils
110
111 # Set up pentadactyl. 
112 apt-get -y install iceweasel
113 apt-get -y -t testing install xul-ext-pentadactyl
114 apt-get -y install vim-gtk
115 su plom -c 'mkdir -p /home/plom/downloads/'
116
117 # Set up openssh-client.
118 apt-get -y install openssh-client
119
120 # Clean up.
121 rm jessie_start_thinkpad.sh
122
123 # Set password for user.
124 passwd plom