add copyright, fix arch
[automated-distro-installer] / fai / config / hooks / partition.DEFAULT
index e64f92b7d58d875daf1c3c77f7313fc979ec04a3..9a8c8363f48defc58293384b7e5c4e552fc35cd8 100755 (executable)
@@ -1,4 +1,19 @@
 #!/bin/bash -x
+# Copyright (C) 2016 Ian Kelling
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
@@ -287,17 +302,14 @@ for subvol in ${s[@]}; do btrfs subvolume delete /mnt/$subvol; done
 btrfs subvolume set-default 0 /mnt
 [[ ! -e /mnt/root_$DISTRO ]] || btrfs subvolume delete /mnt/root_$DISTRO
 
-
 ## create subvols ##
 cd /mnt
-for x in q home_$DISTRO root_$DISTRO; do
-    btrfs subvolume list . | grep "$x$" >/dev/null || btrfs subvolume create $x
-done
+btrfs subvolume create root_$DISTRO
+[[ -e q ]] || btrfs subvolume create q
 chown root:1000 q
 
-
 mkdir -p /mnt/root_$DISTRO/boot
-for x in root/a q/a; do
+for x in q/a q/i; do
     mkdir -p $x
     chown 1000:1000 $x
     chmod 755 $x
@@ -318,19 +330,24 @@ umount /mnt
 ## end create subvols ##
 
 
-
+# note, the mount point /a seems to get automatically created somewhere
 cat > /tmp/fai/fstab <<EOF
 $first_root_crypt  /  btrfs  noatime,subvol=root_$DISTRO  0 0
 $first_root_crypt  /q  btrfs  noatime,subvol=q  0 0
 /q/a  /a  none  bind  0 0
-$first_root_crypt  /home  btrfs  noatime,subvol=home_$DISTRO  0 0
 $first_boot_dev  /boot  btrfs  noatime,subvol=boot_$DISTRO  0 0
 EOF
 
 
 if ifclass treetowl; then
     cat >> /tmp/fai/fstab <<'EOF'
-UUID=3f7b31cd-f299-40b4-a86b-7604282e2715 /i btrfs  noatime    0 2
+UUID=3f7b31cd-f299-40b4-a86b-7604282e2715 /i btrfs  noatime  0 2
+EOF
+fi
+
+if ifclass frodo; then
+    cat >> /tmp/fai/fstab <<'EOF'
+/q/i  /i  none  bind  0 0
 EOF
 fi