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