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