From: Ian Kelling Date: Wed, 2 Mar 2016 09:42:56 +0000 (-0800) Subject: fixes mostly for stable X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=11f823d2d74425b6ff3143ec0106e2504346f496;p=automated-distro-installer fixes mostly for stable --- diff --git a/chboot b/chboot index 37d2516..40f5093 100755 --- 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 diff --git a/fai/config/distro-install-common/end b/fai/config/distro-install-common/end index 28f9d5b..9f92418 100755 --- a/fai/config/distro-install-common/end +++ b/fai/config/distro-install-common/end @@ -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 index 0000000..c3e464b --- /dev/null +++ b/fai/config/files/etc/apt/preferences.d/unstable/DEBIAN @@ -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 diff --git a/fai/config/files/etc/apt/preferences/STABLE b/fai/config/files/etc/apt/preferences/STABLE index 85b26ab..cb23019 100644 --- a/fai/config/files/etc/apt/preferences/STABLE +++ b/fai/config/files/etc/apt/preferences/STABLE @@ -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 index 0000000..28b57d6 --- /dev/null +++ b/fai/config/files/etc/apt/sources.list.d/stable.list/STABLE @@ -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 diff --git a/fai/config/files/etc/apt/sources.list/DEFAULT b/fai/config/files/etc/apt/sources.list.d/testing.list/DEBIAN 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 6a76884..cddde59 100644 --- a/fai/config/files/etc/apt/sources.list/DEFAULT +++ b/fai/config/files/etc/apt/sources.list.d/testing.list/DEBIAN @@ -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 index 0000000..520a1a8 --- /dev/null +++ b/fai/config/files/etc/apt/sources.list.d/unstable.list/DEBIAN @@ -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 index 84b7172..0000000 --- a/fai/config/files/etc/apt/sources.list/GNOME +++ /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 index fb11f69..0000000 --- a/fai/config/files/etc/apt/sources.list/STABLE +++ /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 diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index 0739e91..e8f0c40 100755 --- a/fai/config/hooks/partition.DEFAULT +++ b/fai/config/hooks/partition.DEFAULT @@ -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 diff --git a/fai/config/scripts/GRUB_PC/11-ian b/fai/config/scripts/GRUB_PC/11-ian index 6823a0b..7cc2341 100755 --- a/fai/config/scripts/GRUB_PC/11-ian +++ b/fai/config/scripts/GRUB_PC/11-ian @@ -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