wip using btrfs send for sync
[distro-setup] / distro-begin
index a53cbb4f23ffac9a2d0c583f81b0df620dfe22a7..eda0b4d2f3df013810c86cef0b1145f9314d4f58 100755 (executable)
@@ -69,8 +69,10 @@ for f in iank-dev htpc treetowl x2 frodo tp li lj demohost; do
     eval "$f() { [[ $HOSTNAME == $f ]]; }"
 done
 has_p() { treetowl || iank-dev || x2 || frodo || tp || demohost; }
-has_x() { ! { lj || li; }; }
+has_x() { ! linode; }
 linode() { lj || li; }
+has_btrfs() { ! linode; }
+home_network() { ! linode; }
 encrypted() { has_p; }
 
 shopt -s extglob
@@ -319,12 +321,12 @@ case $(distro-name) in
             if isdebian-stable; then
                 pi firefox/$codename-backports
             else
-                # for a while, firefox/unstable had all it\'s deps satisfied
-                # by testing packages, but now i hit a conflict,
-                # it wanted a newer libfontconfig1, but emacs build-deps
-                # wanted an older one. Oh well, they seem to release
-                # a new esr version every 9 months or so.
-                pi firefox-esr
+                # for a while, firefox/unstable did not have
+                # dependencies satisfied by testing packages, and i hit
+                # a conflict, it wanted a newer libfontconfig1, but
+                # emacs build-deps wanted an older one. note: They seem
+                # to release a new esr version every 9 months or so.
+                pi firefox/unstable
             fi
         fi
         # for hosts which require nonfree drivers
@@ -559,14 +561,16 @@ if [[ $HOSTNAME == treetowl ]]; then
     tu /etc/fstab <<EOF
 /dev/mapper/crypt_dev_$dev /i btrfs  noatime,subvol=i  0 0
 EOF
+
+    tu /etc/crypttab <<EOF
+crypt_dev_$dev  /dev/disk/by-id/$dev  /q/root/luks/host-treetowl  discard,luks
+EOF
+
 else
     tu /etc/fstab <<'EOF'
 /q/i  /i  none  bind  0 0
 EOF
 
-    tu /etc/crypttab <<EOF
-crypt_dev_$dev  /dev/disk/by-id/$dev  /q/root/luks/host-treetowl  discard,luks
-EOF
 fi
 
 tu /etc/fstab <<'EOF'
@@ -580,24 +584,38 @@ if ! mountpoint /kr; then
     s mkdir -p /kr
     s chown ian:traci /kr
 fi
-if [[ $HOSTNAME == treetowl ]]; then
-    tu /etc/fstab <<'EOF'
+
+if home_network; then
+    if [[ $HOSTNAME == treetowl ]]; then
+        tu /etc/fstab <<'EOF'
 /k  /kr  none  bind  0 0
 EOF
-else
-    tu /etc/fstab <<'EOF'
+    else
+        tu /etc/fstab <<'EOF'
 treetowl:/k  /kr  nfs  defaults  0 0
 EOF
+    fi
 fi
 
 s mkdir -p /q/i/{w,k}
 for dir in /{i,w,k}; do
-    if mountpoint $dir; then continue; fi
+    if mountpoint $dir; then continue; fi # already mounted
     s mkdir -p $dir
     s chown ian:ian $dir
     s mount $dir
 done
 
+dir=/nocow
+l=$(sed -rn "s#^(\s*\S+\s+)/q(\s.*)(subvol=q)#\1$dir\2subvol=nocow#p" /etc/fstab)
+if [[ $l ]] && ! mountpoint $dir; then
+    tu /etc/fstab <<EOF
+$l
+EOF
+    s mkdir -p $dir
+    s chown ian:ian $dir
+    s mount $dir
+fi
+
 
 # ssh and probably some other things care about parent directory
 # ownership, and ssh doesn\'t allow any group writable parent