use better practice to avoid overwriting symlnks
[distro-setup] / distro-begin
index 045af1a7fd4eede04b5f761970eb0ab9641e04d3..b0fcdf521f0d1a35b8c71bc10644c02345d67f41 100755 (executable)
@@ -87,6 +87,7 @@ Description=Turn on automatic decryption of drives on boot
 # service that happens late in the game.
 After=postfix.service
 DefaultDependencies=no
+# not sure if needed, makes sure we shut down before reboot.target
 Conflicts=reboot.target
 
 [Service]
@@ -155,12 +156,12 @@ echo path:$PATH
 
 if isfedora; then
     # comment out line disallowing calling sudo in scripts
-    sudo sed -i 's/^Defaults *requiretty/#\0 # ian commented/' /etc/sudoers
+    sudo sed -i --follow-symlinks 's/^Defaults *requiretty/#\0 # ian commented/' /etc/sudoers
     # turn on magic sysrq commands for this boot cycle
     echo 1 > sudo dd of=/proc/sys/kernel/sysrq
     # selinux is not user friendly. Like, you enable samba, but you haven't run the magic selinux commands so it doesn't work
     # and you have no idea why.
-    sudo sed -i 's/^\(SELINUX=\).*/\1disabled/' /etc/selinux/config
+    sudo sed -i --follow-symlinks 's/^\(SELINUX=\).*/\1disabled/' /etc/selinux/config
     selinuxenabled && sudo setenforce 0
 fi
 
@@ -278,17 +279,6 @@ if isarch; then
     }
     aurpi cower pacaur
 
-    # for aur, automatically dl & add gpg keys.
-    # Just the keyserver-options line goes in dirmngr.conf once
-    # this bug is fixed: https://bugs.gnupg.org/gnupg/issue2147
-    for homedir in /home/*; do
-        # this creates ~/.gnupg. addgnupghome is kinda broken on arch.
-        HOME=$homedir gpg -k
-        teeu $homedir/.gnupg/gpg.conf <<EOF
-$(grep -o '^ *keyserver .*' $homedir/.gnupg/dirmngr.conf)
-keyserver-options auto-key-retrieve
-EOF
-    done
     pi pacserve
     x=$(mktemp); /a/opt/pacman.conf-insert_pacserve >$x
     sudo dd of=/etc/pacman.conf if=$x; rm $x
@@ -333,10 +323,10 @@ s lnf /q/root/.editor-backups /q/root/.undo-tree-history \
   /a/opt /a/c/.emacs.d $HOME/mw_vars /k/backup /root
 
 d=/q/p/c/machine_specific/$HOSTNAME/.unison
-if ! s test -L /root/.unison && [[ $(s find /root/.unison -prune -empty) ]]; then
+if ! s test -L /root/.unison && [[ $(s find /root/.unison -prune -empty) ]]; then
     mkdir -p $d
     s chown -R $USER:$USER /root/.unison
-    mv -f /root/.unison/* $d
+    s cp -rT /root/.unison $d
 fi
 s lnf -T $d /root/.unison