various fixes
[distro-setup] / distro-begin
index 5297da810986af9fe2484dbc71b409f4ff0fc6ae..bf298d58e1fa741762ed8584c65aa782d4dd5a97 100755 (executable)
@@ -577,10 +577,17 @@ for dir in /{i,w,k}; do
 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
+if ! mountpoint $dir; then
+    subvol=/mnt/root/nocow
+    if [[ ! -e nocow ]]; then
+        btrfs subvolume create $subvol
+        chown root:1000 $subvol
+        chattr +C $subvol
+    fi
+
+    first_root_crypt=$(awk '$2 == "/" {print $1}' /etc/mtab)
     tu /etc/fstab <<EOF
-$l
+$first_root_crypt  /nocow  btrfs  noatime,subvol=nocow  0 0
 EOF
     s mkdir -p $dir
     s chown ian:ian $dir
@@ -678,14 +685,14 @@ if isdeb; then
     # I haven't gotten around to getting a non-debian exim
     # setup.
     mail-setup exim4
-else
-    mail-setup postfix
+   else
+       mail-setup postfix
 fi
 
-if isubuntu; then
-    # disable crash report annoying crap
-    s dd of=/etc/default/apport <<<'enabled=0'
-fi
+   if isubuntu; then
+       # disable crash report annoying crap
+       s dd of=/etc/default/apport <<<'enabled=0'
+   fi
 
 # fai sets this an old way that doesn't work for stretch.
 # no harm in setting it universally here.