]> piware.de Git - bin.git/blob - postinst-setup-fedora
5cbf68f835e1d8b40299557f99d26fc711a40580
[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 \
17         pavucontrol pulseaudio-utils alsa-plugins-pulseaudio \
18         gstreamer1-plugin-mpg123 gstreamer1-plugins-good \
19         qemu-kvm qemu-img openvpn mutt 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 \
24         gnome-terminal firefox network-manager-applet evince shotwell rhythmbox \
25         offlineimap gnome-keyring pinentry-gnome3 \
26         postfix duplicity systemd-container gnome-disk-utility powertop \
27         git gtimelog libappindicator-gtk3 \
28         schroot mock apt-cacher-ng \
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 #/proc /ubuntu/proc none bind 0 0
41 #/sys /ubuntu/sys none bind 0 0
42 #/dev /ubuntu/dev none rbind 0 0
43 #/home /ubuntu/home none rbind 0 0
44 #/srv /ubuntu/srv none bind 0 0
45 #/tmp /ubuntu/tmp none bind 0 0
46 EOF
47
48 # have schroot use tmpfs
49 if [ ! -L /var/lib/schroot/unpack ]; then
50     rmdir /var/lib/schroot/unpack || true
51     ln -s /tmp /var/lib/schroot/unpack
52 fi
53
54 # disable SELinux to unbreak ecryptfs
55 sed -i '/^SELINUX=/ s/=.*$/=disabled/' /etc/selinux/config
56 setenforce 0 || true
57
58 rm -f /etc/systemd/system/default.target
59 systemctl set-default graphical.target
60 systemctl enable --now apt-cacher-ng
61
62 # create user
63 if ! getent passwd martin >/dev/null; then
64     groupadd --gid 1000 martin
65     useradd --comment "Martin Pitt" --uid 1000 --gid 1000 --groups wheel,ecryptfs,mock martin
66     passwd martin
67 fi
68
69 if [ ! -d /home/martin/bin ]; then
70     echo "log in as martin on another terminal to decrypt home directory; press Enter to continue"
71     read
72 fi
73
74 # root's ssh stuff
75 if [ ! -d /root/.ssh ] && [ -d /home/martin/.ssh ]; then
76     mkdir -p /root/.ssh
77     chmod 700 /root/.ssh
78     cp /home/martin/.ssh/id_rsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/
79 fi
80
81 # restore /etc git branch
82 if [ ! -d /etc/.git ]; then
83     [ -e /backup-etc ] || git clone git+ssh://martin@piware.de/home/martin/backup/`hostname`-etc-fedora/ /backup-etc
84     cp -av /backup-etc/* /etc/
85     cp -av /backup-etc/.git/ /etc/
86     rm -rf /backup-etc
87 fi
88 systemctl enable --now postfix
89
90 # crontabs
91 crontab -u martin - <<EOF
92 # m h  dom mon dow   command
93 05 * * * * \$HOME/bin/backup >/dev/null
94 EOF
95
96 # Red Hat VPN certs and connections
97 dnf install ~martin/Dokumente/Arbeit/RedHat/redhat-internal*.rpm