change fileserver host
authorIan Kelling <ian@iankelling.org>
Wed, 28 Sep 2016 01:12:33 +0000 (18:12 -0700)
committerIan Kelling <ian@iankelling.org>
Wed, 28 Sep 2016 01:12:33 +0000 (18:12 -0700)
distro-begin
distro-end

index 1c15acf25725d080de5f286e6b7dcda6affab34d..f61b2f17f45ed0727070330a0cc8d4d026626663 100755 (executable)
@@ -213,7 +213,7 @@ lnf ${opts[@]} "$1" /home/traci/$2
 EOF
 }
 
-for x in /a/c/repos/bash/!(.git); do
+for x in /a/c/repos/bash/!(.git|..|.); do
     lnf-home "$x"
     sudo -i <<EOF
 PATH="/a/exe:$PATH"
@@ -582,17 +582,17 @@ tu /etc/fstab <<'EOF'
 /i/k  /k  none  bind  0 0
 EOF
 
-if ! mountpoint /kfrodo; then
-    s mkdir -p /kfrodo
-    s chown ian:traci /kfrodo
+if ! mountpoint /kr; then
+    s mkdir -p /kr
+    s chown ian:traci /kr
 fi
-if [[ $HOSTNAME == frodo ]]; then
+if [[ $HOSTNAME == treetowl ]]; then
     tu /etc/fstab <<'EOF'
-/k  /kfrodo  none  bind  0 0
+/k  /kr  none  bind  0 0
 EOF
 else
     tu /etc/fstab <<'EOF'
-frodo:/k  /kfrodo  nfs  defaults  0 0
+treetowl:/k  /kr  nfs  defaults  0 0
 EOF
 fi
 
@@ -699,7 +699,7 @@ fi
 # using debconf-set-selection, the area gets reset to ETC
 # on my linode test machine after doing a dpkg-reconfigure, or a reinstall,
 # so we are using expect :(
-apt-get install --no-install-recommends expect
+s apt-get -y install --no-install-recommends expect
 s expect <<EOF
 set force_conservative 0
 spawn dpkg-reconfigure tzdata -freadline
index 13a4dd102c6c8d49b6993155d79cbf1362abe9ae..392bcef5d9e1ffeea304ea2836ec684e1afad68b 100755 (executable)
@@ -288,7 +288,7 @@ esac
 ####### misc packages ###########
 
 
-if [[ $HOSTNAME == frodo ]]; then
+if [[ $HOSTNAME == treetowl ]]; then
     case $distro in
         debian|ubuntu)
             # note i had to do this, which is persistent:
@@ -378,7 +378,7 @@ for f in /home/*; do
   "profiles" : [
     {
       "profile-name" : "Default",
-      "hostname" : "frodo",
+      "hostname" : "treetowl",
       "rpc-url-path" : "/transmission/rpc",
       "username" : "",
       "password" : "",
@@ -726,7 +726,11 @@ WantedBy=sockets.target
 EOF
         # had this fail with 'Failed to connect to bus: No such file or directory'
         # then when I tried it manually, it worked fine...
-        systemctl --user daemon-reload
+        if ! systemctl --user daemon-reload; then
+            sleep 2
+            echo retrying systemd user daemon reload
+            systemctl --user daemon-reload
+        fi
         ;;&
     *)
         # taken from arch wiki.
@@ -817,7 +821,7 @@ color-scheme 2
 EOF
 
 
-if [[ $HOSTNAME == frodo ]] && ! sudo test -e /etc/openvpn/client.key; then
+if [[ $HOSTNAME == treetowl ]] && ! sudo test -e /etc/openvpn/client.key; then
     /a/bin/vpn-setup/vpn-mk-client-cert dopub
 fi
 
@@ -963,26 +967,19 @@ EOF
         ;;
 esac
 
-if [[ $HOSTNAME == frodo ]]; then
-    tu /etc/exports <<'EOF'
-/k 192.168.1.0/24(rw,nohide,no_subtree_check,insecure)
-EOF
-    s exportfs -rav
-fi
-
-if [[ -e /k/video ]]; then
+if [[ $HOSTNAME == treetowl ]]; then
     # nohide = export filesystems mounted deeper than the export point
     # fsid=0 makes this export the "root" export
     # not documented in the man page, but this means
     # 1. it can be mounted with a shorthand of server:/
     # 2. exports that are subdirectories of this one will automatically be mounted
-    tu /etc/exports '/i/video 192.168.1.0/24(rw,fsid=0,nohide,no_root_squash,async,no_subtree_check,insecure)'
+    tu /etc/exports <<'EOF'
+/k 192.168.1.0/24(rw,fsid=0,nohide,no_root_squash,async,no_subtree_check,insecure)
+EOF
     s exportfs -rav
-    showmount -e localhost
 fi
 
 
-
 e "$end_msg_var"
 
 
@@ -1047,47 +1044,49 @@ if ! s virsh list --all --name | grep -xF win10 &>/dev/null; then
 fi
 
 
-pi samba
-# note samba re-reads it's config every 1 minute
-case $distro in
-    arch) s cp /etc/samba/smb.conf.default /etc/samba/smb.conf ;;
-esac
+if [[ $HOSTNAME == treetowl ]]; then
+    pi samba
+    # note samba re-reads it\'s config every 1 minute
+    case $distro in
+        arch) s cp /etc/samba/smb.conf.default /etc/samba/smb.conf ;;
+    esac
 
-# add 2 lines after workgroup option
-s sed -ri --follow-symlinks '/^\s*encrypt passwords\s*=/d' /etc/samba/smb.conf
-s sed -ri --follow-symlinks '/^\s*map to guest\s*=/d' /etc/samba/smb.conf
-s sed -i --follow-symlinks 's/\(\s*workgroup\s*=\).*/\1 WORKGROUP\n\tencrypt passwords = yes\n\tmap to guest = bad password/'  /etc/samba/smb.conf
-# remove default homes section. not sharing that.
-s sed -ri --follow-symlinks '/^\s*\[homes\]/,/\s*\[/d' /etc/samba/smb.conf
+    # add 2 lines after workgroup option
+    s sed -ri --follow-symlinks '/^\s*encrypt passwords\s*=/d' /etc/samba/smb.conf
+    s sed -ri --follow-symlinks '/^\s*map to guest\s*=/d' /etc/samba/smb.conf
+    s sed -i --follow-symlinks 's/\(\s*workgroup\s*=\).*/\1 WORKGROUP\n\tencrypt passwords = yes\n\tmap to guest = bad password/'  /etc/samba/smb.conf
+    # remove default homes section. not sharing that.
+    s sed -ri --follow-symlinks '/^\s*\[homes\]/,/\s*\[/d' /etc/samba/smb.conf
 
-if ! grep -xF '[public]' /etc/samba/smb.conf &>/dev/null; then
-    s tee -a /etc/samba/smb.conf <<'EOF'
+    if ! grep -xF '[public]' /etc/samba/smb.conf &>/dev/null; then
+        s tee -a /etc/samba/smb.conf <<'EOF'
 [public]
       guest ok = yes
       read only = no
-      path = /kfrodo
+      path = /kr
 EOF
-fi
+    fi
 
-case $distro in
-    debian|ubuntu)
-        # systemd claims it generates units from /etc/init.d, but it
-        # clearly doesn\'t in debian. I have no idea how they are
-        # related. fuck debian right now. It\'s not documented.  samba
-        # has a systemd init file linked to /dev/null.  There\'s this
-        # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769714 which
-        # claims samba\'s sub-services will be started automatically by
-        # systemd... it didn\'t on install, wonder if it will on
-        # boot. It clued me in how to start it manually though. Nothing
-        # in /usr/share/doc/samba, debian admin guide says nothing about
-        # any of this. (this is in debian testing as of 4/2016).
-
-        s /etc/init.d/samba start
-        ;;
-    arch)
-        sgo samba
-        ;;
-esac
+    case $distro in
+        debian|ubuntu)
+            # systemd claims it generates units from /etc/init.d, but it
+            # clearly doesn\'t in debian. I have no idea how they are
+            # related. fuck debian right now. It\'s not documented.  samba
+            # has a systemd init file linked to /dev/null.  There\'s this
+            # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769714 which
+            # claims samba\'s sub-services will be started automatically by
+            # systemd... it didn\'t on install, wonder if it will on
+            # boot. It clued me in how to start it manually though. Nothing
+            # in /usr/share/doc/samba, debian admin guide says nothing about
+            # any of this. (this is in debian testing as of 4/2016).
+
+            s /etc/init.d/samba start
+            ;;
+        arch)
+            sgo samba
+            ;;
+    esac
+fi
 
 tu /etc/hosts <<< "127.0.1.1 $(hostname).lan $(hostname)"