]> piware.de Git - bin.git/blob - postinst-setup-fedora
xvim: Use daytime-term
[bin.git] / postinst-setup-fedora
1 #!/bin/sh
2 set -e
3
4 if ! type offlineimap >/dev/null 2>&1; then
5     # remove stuff that we do not need
6     dnf remove -y mdadm mlocate nano rsyslog sssd telnet trousers rxvt-unicode abrt plymouth linux-atm-libs quota realmd selinux-policy audit || true
7
8     # install stuff that we do want
9     dnf install -y iwl6000g2a-firmware NetworkManager-wifi dnsmasq \
10         sudo ecryptfs-utils vim-enhanced iwl6000g2a-firmware \
11         dnf-utils bash-completion \
12         xorg-x11-server-Xorg xorg-x11-drv-libinput xorg-x11-drv-intel \
13         mesa-dri-drivers lxrandr \
14         dejavu-sans-fonts dejavu-serif-fonts dejavu-sans-mono-fonts \
15         xorg-x11-server-utils xorg-x11-utils xbacklight \
16         i3 i3lock lxdm wmctrl dunst pcmanfm gvfs-mtp parole \
17         pavucontrol pulseaudio-utils alsa-plugins-pulseaudio \
18         gstreamer1-plugin-mpg123 gstreamer1-plugins-good \
19         qemu-kvm qemu-img openvpn mutt w3m weechat pidgin-otr \
20         simple-scan sane-backends sane-backends-drivers-scanners \
21         pandoc texlive-beamer texlive-latex-bin texlive-collection-fontsrecommended \
22         texlive-hyphen-german texlive-hyphen-english texlive-fancyhdr texlive-dinbrief \
23         texlive-german texlive-a4wide \
24         gnome-terminal firefox network-manager-applet evince shotwell rhythmbox \
25         offlineimap gnome-keyring pinentry-gnome3 \
26         duplicity systemd-container gnome-disk-utility powertop \
27         git gtimelog libappindicator-gtk3 gnome-screenshot \
28         schroot mock apt-cacher-ng strace wget patchutils \
29
30     # codecs
31     dnf install -y http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
32     dnf install -y gstreamer1-{libav,plugins-{ugly,bad-free}} --setopt=strict=0
33 fi
34
35 # other setup
36 grep -q lib/mock /etc/fstab || cat << EOF >> /etc/fstab
37
38 tmpfs /var/tmp tmpfs defaults 0 0
39 tmpfs /var/lib/mock tmpfs defaults 0 0
40 EOF
41 #ln -s fedora-27-x86_64.cfg /etc/mock/default.cfg
42
43 # have schroot use tmpfs
44 if [ ! -L /var/lib/schroot/unpack ]; then
45     rmdir /var/lib/schroot/unpack || true
46     ln -s /tmp /var/lib/schroot/unpack
47 fi
48
49 # disable SELinux to unbreak ecryptfs
50 sed -i '/^SELINUX=/ s/=.*$/=disabled/' /etc/selinux/config
51 setenforce 0 || true
52
53 rm -f /etc/systemd/system/default.target
54 systemctl set-default graphical.target
55 systemctl enable --now apt-cacher-ng
56
57 # create user
58 if ! getent passwd martin >/dev/null; then
59     groupadd --gid 1000 martin
60     useradd --comment "Martin Pitt" --uid 1000 --gid 1000 --groups wheel,ecryptfs,mock martin
61     passwd martin
62 fi
63
64 if [ ! -d /home/martin/bin ]; then
65     echo "log in as martin on another terminal to decrypt home directory; press Enter to continue"
66     read
67 fi
68
69 # root's ssh stuff
70 if [ ! -d /root/.ssh ] && [ -d /home/martin/.ssh ]; then
71     mkdir -p /root/.ssh
72     chmod 700 /root/.ssh
73     cp /home/martin/.ssh/id_rsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/
74 fi
75
76 # restore /etc git branch
77 if [ ! -d /etc/.git ]; then
78     [ -e /backup-etc ] || git clone git+ssh://martin@piware.de/home/martin/backup/`hostname`-etc-fedora/ /backup-etc
79     cp -av /backup-etc/* /etc/
80     cp -av /backup-etc/.git/ /etc/
81     rm -rf /backup-etc
82 fi
83
84 # crontabs
85 crontab -u martin - <<EOF
86 # m h  dom mon dow   command
87 05 * * * * \$HOME/bin/backup >/dev/null
88 EOF
89
90 # Red Hat VPN certs and connections
91 dnf install ~martin/Dokumente/Arbeit/RedHat/redhat-internal*.rpm