]> piware.de Git - bin.git/blobdiff - postinst-setup-fedora
debian-backport-cockpit: Fix for stretch, disable jessie
[bin.git] / postinst-setup-fedora
index 8ea93e15fe45a4797011130dc9953104b4e85f38..afd4fa96ad14aaf04b4566a3cbfd54ac7f7d6c35 100755 (executable)
@@ -1,58 +1,55 @@
 #!/bin/sh
 set -e
 
-# remove stuff that we do not need
-dnf remove -y mdadm mlocate nano rsyslog sssd telnet trousers rxvt-unicode abrt plymouth linux-atm-libs quota realmd selinux-policy || true
+if ! type offlineimap >/dev/null 2>&1; then
+    # remove stuff that we do not need
+    dnf remove -y mdadm mlocate nano rsyslog sssd telnet trousers rxvt-unicode abrt plymouth linux-atm-libs quota realmd selinux-policy audit || true
 
-# install stuff that we do want
-dnf install -y iwl6000g2a-firmware NetworkManager-wifi \
-    sudo ecryptfs-utils vim-enhanced iwl6000g2a-firmware \
-    xorg-x11-server-Xorg xorg-x11-drv-libinput xorg-x11-drv-intel \
-    dejavu-sans-fonts dejavu-serif-fonts dejavu-sans-mono-fonts \
-    xorg-x11-server-utils xorg-x11-utils xbacklight \
-    i3 i3lock lxdm wmctrl dunst pcmanfm gvfs-mtp \
-    pavucontrol pulseaudio-utils alsa-plugins-pulseaudio \
-    gstreamer1-plugin-mpg123 gstreamer1-plugins-good \
-    qemu-kvm qemu-img openvpn mutt weechat pidgin-otr \
-    simple-scan sane-backends sane-backends-drivers-scanners \
-    pandoc texlive-beamer texlive-latex-bin texlive-collection-fontsrecommended \
-    texlive-hyphen-german texlive-hyphen-english texlive-fancyhdr \
-    gnome-terminal firefox network-manager-applet evince shotwell rhythmbox \
-    offlineimap gnome-keyring pinentry-gnome3 \
-    postfix duplicity systemd-container gnome-disk-utility powertop \
-    git gtimelog libappindicator-gtk3 \
-    schroot mock \
+    # install stuff that we do want
+    dnf install -y iwl6000g2a-firmware NetworkManager-wifi dnsmasq \
+        sudo ecryptfs-utils vim-enhanced iwl6000g2a-firmware \
+        dnf-utils bash-completion \
+        xorg-x11-server-Xorg xorg-x11-drv-libinput xorg-x11-drv-intel \
+        mesa-dri-drivers lxrandr \
+        dejavu-sans-fonts dejavu-serif-fonts dejavu-sans-mono-fonts \
+        xorg-x11-server-utils xorg-x11-utils xbacklight \
+        i3 i3lock lxdm wmctrl dunst pcmanfm gvfs-mtp parole \
+        pavucontrol pulseaudio-utils alsa-plugins-pulseaudio \
+        gstreamer1-plugin-mpg123 gstreamer1-plugins-good \
+        qemu-kvm qemu-img openvpn mutt w3m weechat pidgin-otr \
+        simple-scan sane-backends sane-backends-drivers-scanners \
+        pandoc texlive-beamer texlive-latex-bin texlive-collection-fontsrecommended \
+        texlive-hyphen-german texlive-hyphen-english texlive-fancyhdr texlive-dinbrief \
+        texlive-german texlive-a4wide \
+        gnome-terminal firefox network-manager-applet evince shotwell rhythmbox \
+        offlineimap gnome-keyring pinentry-gnome3 \
+        postfix duplicity systemd-container gnome-disk-utility powertop \
+        git gtimelog libappindicator-gtk3 gnome-screenshot \
+        schroot mock apt-cacher-ng strace wget patchutils \
 
-# codecs
-dnf install -y http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
-dnf install -y gstreamer1-{libav,plugins-{ugly,bad-free}} --setopt=strict=0
-
-# TODO: restore /etc git
+    # codecs
+    dnf install -y http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
+    dnf install -y gstreamer1-{libav,plugins-{ugly,bad-free}} --setopt=strict=0
+fi
 
 # other setup
-grep -q /ubuntu /etc/fstab || cat << EOF >> /etc/fstab
+grep -q lib/mock /etc/fstab || cat << EOF >> /etc/fstab
 
 tmpfs /var/tmp tmpfs defaults 0 0
 tmpfs /var/lib/mock tmpfs defaults 0 0
-/proc /ubuntu/proc none bind 0 0
-/sys /ubuntu/sys none bind 0 0
-/dev /ubuntu/dev none rbind 0 0
-/home /ubuntu/home none rbind 0 0
-/srv /ubuntu/srv none bind 0 0
-/tmp /ubuntu/tmp none bind 0 0
+#/proc /ubuntu/proc none bind 0 0
+#/sys /ubuntu/sys none bind 0 0
+#/dev /ubuntu/dev none rbind 0 0
+#/home /ubuntu/home none rbind 0 0
+#/srv /ubuntu/srv none bind 0 0
+#/tmp /ubuntu/tmp none bind 0 0
 EOF
-
-systemctl enable ubuntu-apt-cacher-ng
+#ln -s fedora-27-x86_64.cfg /etc/mock/default.cfg
 
 # have schroot use tmpfs
-rmdir /var/lib/schroot/unpack
-ln -s /tmp /var/lib/schroot/unpack
-
-# root's ssh stuff
-if [ ! -d /root/.ssh ] && [ -d /home/martin/.ssh ]; then
-    mkdir -p /root/.ssh
-    chmod 700 /root/.ssh
-    cp /home/martin/.ssh/id_rsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/
+if [ ! -L /var/lib/schroot/unpack ]; then
+    rmdir /var/lib/schroot/unpack || true
+    ln -s /tmp /var/lib/schroot/unpack
 fi
 
 # disable SELinux to unbreak ecryptfs
@@ -61,16 +58,41 @@ setenforce 0 || true
 
 rm -f /etc/systemd/system/default.target
 systemctl set-default graphical.target
-
-systemctl enable --now postfix
+systemctl enable --now apt-cacher-ng
 
 # create user
-groupadd --gid 1000 martin
-useradd --comment "Martin Pitt" --uid 1000 --gid 1000 --groups wheel,ecryptfs,mock martin
-passwd martin
+if ! getent passwd martin >/dev/null; then
+    groupadd --gid 1000 martin
+    useradd --comment "Martin Pitt" --uid 1000 --gid 1000 --groups wheel,ecryptfs,mock martin
+    passwd martin
+fi
+
+if [ ! -d /home/martin/bin ]; then
+    echo "log in as martin on another terminal to decrypt home directory; press Enter to continue"
+    read
+fi
+
+# root's ssh stuff
+if [ ! -d /root/.ssh ] && [ -d /home/martin/.ssh ]; then
+    mkdir -p /root/.ssh
+    chmod 700 /root/.ssh
+    cp /home/martin/.ssh/id_rsa* /home/martin/.ssh/known_hosts /home/martin/.ssh/config /root/.ssh/
+fi
+
+# restore /etc git branch
+if [ ! -d /etc/.git ]; then
+    [ -e /backup-etc ] || git clone git+ssh://martin@piware.de/home/martin/backup/`hostname`-etc-fedora/ /backup-etc
+    cp -av /backup-etc/* /etc/
+    cp -av /backup-etc/.git/ /etc/
+    rm -rf /backup-etc
+fi
+systemctl enable --now postfix
 
 # crontabs
 crontab -u martin - <<EOF
 # m h  dom mon dow   command
 05 * * * * \$HOME/bin/backup >/dev/null
 EOF
+
+# Red Hat VPN certs and connections
+dnf install ~martin/Dokumente/Arbeit/RedHat/redhat-internal*.rpm