fixes mostly for stable
authorIan Kelling <ian@iankelling.org>
Wed, 2 Mar 2016 09:42:56 +0000 (01:42 -0800)
committerIan Kelling <ian@iankelling.org>
Mon, 6 Feb 2017 06:21:41 +0000 (22:21 -0800)
chboot
fai/config/distro-install-common/end
fai/config/files/etc/apt/preferences.d/unstable/DEBIAN [new file with mode: 0644]
fai/config/files/etc/apt/preferences/STABLE
fai/config/files/etc/apt/sources.list.d/stable.list/STABLE [new file with mode: 0644]
fai/config/files/etc/apt/sources.list.d/testing.list/DEBIAN [moved from fai/config/files/etc/apt/sources.list/DEFAULT with 87% similarity]
fai/config/files/etc/apt/sources.list.d/unstable.list/DEBIAN [new file with mode: 0644]
fai/config/files/etc/apt/sources.list/GNOME [deleted file]
fai/config/files/etc/apt/sources.list/STABLE [deleted file]
fai/config/hooks/partition.DEFAULT
fai/config/scripts/GRUB_PC/11-ian

diff --git a/chboot b/chboot
index 37d2516bb1cf941753a949b6ff9a0259b4592470..40f509367cb64fbc5d9a40b990757cb0601101c5 100755 (executable)
--- a/chboot
+++ b/chboot
@@ -1,7 +1,8 @@
 #!/bin/bash -x
 
 # Set grub to boot into a different distro, and reboot unless -r
-# $0 DISTRO_NAME
+# $0 [DISTRO_NAME]
+# with no argument, print available distros
 
 # DISTRO_NAME is based on the partition names in /boot. eg boot_debianjessie
 
@@ -23,6 +24,12 @@ distro=$1
 
 ###### end command line parsing #####
 
+if [[ ! $distro ]]; then
+    echo "available distros:"
+    btrfs subvolume list /boot | sed -rn 's/^.*boot_(.*)/\1/p'
+    exit 0
+fi
+
 if ! btrfs subvolume list /boot | grep "_$distro$" &>/dev/null; then
     echo "$0: error: _$distro$ not found in btrfs subvolume list /boot:"
     btrfs subvolume list /boot
index 28f9d5b5f835eea8d7bbcd63a742383407cf3c44..9f92418102085471491f2e116ea9386040c89ceb 100755 (executable)
@@ -18,11 +18,18 @@ echo 'ian  ALL=(ALL)  NOPASSWD: ALL' >> $target/etc/sudoers
 
 dir=/q/p/c/machine_specific/$HOSTNAME/.unison
 $ROOTCMD mkdir -p $dir
-$ROOTCMD chown 1000:1000 $dir
+
 $ROOTCMD rm -rf /root/.unison
 $ROOTCMD ln -s $dir /root
 $ROOTCMD ln -s /q/p /
 
+while true; do
+    $ROOTCMD chown 1000:1000 $dir
+    $ROOTCMD chmod 660 $dir
+    dir=$(dirname $dir)
+    [[ $dir != /q ]] || break
+done
+
 # kvm is normally created by some package,
 # but unison doesn't like unknown groups, so make it now so initial sync works.
 $ROOTCMD groupadd kvm
diff --git a/fai/config/files/etc/apt/preferences.d/unstable/DEBIAN b/fai/config/files/etc/apt/preferences.d/unstable/DEBIAN
new file mode 100644 (file)
index 0000000..c3e464b
--- /dev/null
@@ -0,0 +1,21 @@
+Explanation: https://debian-handbook.info/browse/stable/sect.apt-get.html#sect.apt.priorities
+Explanation: And man apt_preferences
+Explanation: Installed packages get 100 priority, so this won't upgrade testing
+Explanation: packages unless explicitly asked to. Just went middlish between 1-100
+Explanation: Install with apt-get install package/testing. But if dependencies are
+Explanation: needed, or need upgrading,
+Explanation: apt-get -t testing package, setting testing to priority
+Explanation: 990 just for that command.
+Explanation: Use apt-cache policy to verify these settings.
+Package: *
+Pin: release a=unstable
+Pin-Priority: 30
+
+Package: *
+Pin: release a=unstable-updates
+Pin-Priority: 30
+
+
+Explanation: Allow this testing package to automatically upgrade.
+Package: unison
+Pin-Piority: 100
index 85b26ab777cd8f094f13c5b94acad2836c5c7f65..cb23019bc4991d14f096f5d7aafbbcb7e57b37f6 100644 (file)
@@ -1,12 +1,3 @@
-Explanation: https://debian-handbook.info/browse/stable/sect.apt-get.html#sect.apt.priorities
-Explanation: And man apt_preferences
-Explanation: Installed packages get 100 priority, so this won't upgrade testing
-Explanation: packages unless explicitly asked to.
-Explanation: Install with apt-get install package/testing. But if dependencies are
-Explanation: needed, or need upgrading,
-Explanation: apt-get -t testing package, setting testing to priority
-Explanation: 990 just for that command.
-Explanation: Use apt-cache policy to verify these settings.
 Package: *
 Pin: release a=testing
 Pin-Priority: 50
@@ -14,7 +5,3 @@ Pin-Priority: 50
 Package: *
 Pin: release a=testing-updates
 Pin-Priority: 50
-
-Explanation: Allow this testing package to automatically upgrade.
-Package: unison
-Pin-Piority: 100
diff --git a/fai/config/files/etc/apt/sources.list.d/stable.list/STABLE b/fai/config/files/etc/apt/sources.list.d/stable.list/STABLE
new file mode 100644 (file)
index 0000000..28b57d6
--- /dev/null
@@ -0,0 +1,8 @@
+deb http://http.us.debian.org/debian jessie main
+deb-src http://http.us.debian.org/debian jessie main
+
+deb http://security.debian.org/ jessie/updates main
+deb-src http://security.debian.org/ jessie/updates main
+
+deb http://http.us.debian.org/debian jessie-updates main
+deb-src http://http.us.debian.org/debian jessie-updates main
similarity index 87%
rename from fai/config/files/etc/apt/sources.list/DEFAULT
rename to fai/config/files/etc/apt/sources.list.d/testing.list/DEBIAN
index 6a768849d17b35722822395b09ad7e40e77903ea..cddde59fec01ac56bf18e19ac327dc18d69baac8 100644 (file)
@@ -4,6 +4,5 @@ deb-src http://http.us.debian.org/debian testing main
 deb http://security.debian.org/ testing/updates main
 deb-src http://security.debian.org/ testing/updates main
 
-# jessie-updates, previously known as 'volatile'
 deb http://http.us.debian.org/debian testing-updates main
 deb-src http://http.us.debian.org/debian testing-updates main
diff --git a/fai/config/files/etc/apt/sources.list.d/unstable.list/DEBIAN b/fai/config/files/etc/apt/sources.list.d/unstable.list/DEBIAN
new file mode 100644 (file)
index 0000000..520a1a8
--- /dev/null
@@ -0,0 +1,2 @@
+deb http://http.us.debian.org/debian unstable main
+deb-src http://http.us.debian.org/debian unstable main
diff --git a/fai/config/files/etc/apt/sources.list/GNOME b/fai/config/files/etc/apt/sources.list/GNOME
deleted file mode 100644 (file)
index 84b7172..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-deb http://httpredir.debian.org/debian jessie main contrib non-free
-deb http://httpredir.debian.org/debian-security jessie/updates main contrib non-free
diff --git a/fai/config/files/etc/apt/sources.list/STABLE b/fai/config/files/etc/apt/sources.list/STABLE
deleted file mode 100644 (file)
index fb11f69..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# deb http://http.us.debian.org/debian jessie main
-
-deb http://http.us.debian.org/debian jessie main
-deb-src http://http.us.debian.org/debian jessie main
-
-deb http://security.debian.org/ jessie/updates main
-deb-src http://security.debian.org/ jessie/updates main
-
-# jessie-updates, previously known as 'volatile'
-deb http://http.us.debian.org/debian jessie-updates main
-deb-src http://http.us.debian.org/debian jessie-updates main
-
-
-deb http://http.us.debian.org/debian testing main
-deb-src http://http.us.debian.org/debian testing main
-
-deb http://security.debian.org/ testing/updates main
-deb-src http://security.debian.org/ testing/updates main
-
-# jessie-updates, previously known as 'volatile'
-deb http://http.us.debian.org/debian testing-updates main
-deb-src http://http.us.debian.org/debian testing-updates main
index 0739e91c390a0cdf1151b97d107d737ec6a117dc..e8f0c401850232165c3fbdc5b006a936c62e36d4 100755 (executable)
@@ -10,7 +10,6 @@ skiptask partition || ! type skiptask # for running not in fai
 
 #### begin configuration
 
-partition=true # change to true to force a full wipe
 bootn=3
 rootn=1
 swapn=2
@@ -20,6 +19,12 @@ boot_mib=1500
 
 ##### end configuration
 
+if ifclass REPARTITION;then
+    partition=true # force a full wipe
+else
+    partition=false # change to true to force a full wipe
+fi
+
 lastn=$bios_grubn
 
 
@@ -177,6 +182,7 @@ btrfs subvolume set-default 0 /mnt
 cd /mnt
 for x in q home_$DISTRO root_$DISTRO; do
     btrfs subvolume list . | grep "$x$" >/dev/null || btrfs subvolume create $x
+    chown root:1000 q
 done
 mkdir -p /mnt/root_$DISTRO/boot
 for x in root/a q/a; do
index 6823a0bcec29748ffab1986226ee0e901f2803a8..7cc2341da53ff0234605ab6c460318458a369c88 100755 (executable)
@@ -10,20 +10,29 @@ if ifclass STABLE; then
     fcopy -M /etc/apt/preferences
 fi
 
+if ifclass DEBIAN; then
+    fcopy -M /etc/apt/preferences.d/unstable
+    fcopy -riM /etc/apt/sources.list.d
+fi
+
 
 # -i, ignore nonmatching class error, always return 0.
 fcopy -r -M -i /home/ian/.ssh
 /var/lib/fai/config/distro-install-common/end
 
+rm -f /target/etc/apt/sources.list
 
-# could also use: chroot /target script-file
-$ROOTCMD chown -R 1000:1000 /home/ian/.ssh
-$ROOTCMD chmod -R u=Xrw,og= /home/ian/.ssh
-$ROOTCMD cp -ar /home/ian/.ssh /root
-$ROOTCMD chown -R root:root /root/.ssh
+chroot /target bash <<'EOF'
+chown -R 1000:1000 /home/ian/.ssh
+chmod -R u=Xrw,og= /home/ian/.ssh
+cp -ar /home/ian/.ssh /root
+chown -R root:root /root/.ssh
 
 # default jessie groups + kvm & systemd-journal
-$ROOTCMD usermod -aG cdrom,floppy,sudo,audio,dip,video,plugdev,netdev,kvm,systemd-journal ian
-
+usermod -aG cdrom,floppy,sudo,audio,dip,video,plugdev,netdev,kvm,systemd-journal ian
+EOF
 
-$ROOTCMD apt-get -y install unison/testing
+if ifclass STABLE; then
+    apt-get -y install unison-gtk
+    apt-get -y install unison-gtk/testing
+fi