From cbf2683420ede7d0cc5317ed499e296c843f894d Mon Sep 17 00:00:00 2001 From: JeremyRand Date: Fri, 7 Jun 2019 17:05:58 +0000 Subject: [PATCH] Support suites other than Stretch (#96) * Support suites other than Stretch * Insert suite into image filename * Fix installing Firefox on Sid * Fix downloading Chromium on Sid * Don't use sid-updates or security sid/updates --- README.md | 2 + makefile | 7 ++- resources/BuildResources/backports.list | 1 + .../{apt-preferences => backports.pref} | 8 --- resources/BuildResources/buster.list | 3 + resources/BuildResources/buster.pref | 5 ++ resources/BuildResources/sid.list | 3 + resources/BuildResources/sid.pref | 5 ++ resources/BuildResources/sources.list | 16 ----- resources/BuildResources/updates.list | 6 ++ scripts/InstallScripts/InstallPackages.sh | 4 +- scripts/buildFilesystem.sh | 58 ++++++++++++++++--- 12 files changed, 83 insertions(+), 35 deletions(-) create mode 100644 resources/BuildResources/backports.list rename resources/BuildResources/{apt-preferences => backports.pref} (56%) create mode 100644 resources/BuildResources/buster.list create mode 100644 resources/BuildResources/buster.pref create mode 100644 resources/BuildResources/sid.list create mode 100644 resources/BuildResources/sid.pref create mode 100644 resources/BuildResources/updates.list diff --git a/README.md b/README.md index 88ffa2b..4a845b7 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,8 @@ TO begin with: `make kernel_inject` Injects a newly built kernel into a previously build PrawnOS.img located in the root of the checkout. Usually, this will be a copy of the -BASE image made by make filesystem. Only use this if you already have a built kernel and filesystem -BASE image. +You can use the environment variable `PRAWNOS_SUITE` to use a Debian suite other than `stretch`. For example, to use Debian Buster, you can build with `sudo PRAWNOS_SUITE=buster make image`. Note that only `stretch` and `buster` have been tested. + You can use the environment variable `PRAWNOS_DEBOOTSTRAP_MIRROR` to use a non-default Debian mirror with debootstrap. For example, to use [Debian's Tor onion service mirror](https://onion.debian.org/) with debootstrap, you can build with `sudo PRAWNOS_DEBOOTSTRAP_MIRROR=http://vwakviie2ienjx6t.onion/debian make image`. diff --git a/makefile b/makefile index 8f47b79..7d89c82 100644 --- a/makefile +++ b/makefile @@ -14,7 +14,10 @@ # along with PrawnOS. If not, see . KVER=4.17.19 -OUTNAME=PrawnOS-Alpha-c201-libre-2GB.img +ifeq ($(PRAWNOS_SUITE),) +PRAWNOS_SUITE=stretch +endif +OUTNAME=PrawnOS-$(PRAWNOS_SUITE)-Alpha-c201-libre-2GB.img BASE=$(OUTNAME)-BASE @@ -79,7 +82,7 @@ kernel_inject: #Targets an already built .img and swaps the old kernel with the .PHONY: injected_image injected_image: #makes a copy of the base image with a new injected kernel make kernel - cp PrawnOS-Alpha-c201-libre-2GB.img-BASE PrawnOS-Alpha-c201-libre-2GB.img + cp $(BASE) $(OUTNAME) make kernel_inject .PHONY: image diff --git a/resources/BuildResources/backports.list b/resources/BuildResources/backports.list new file mode 100644 index 0000000..97f922c --- /dev/null +++ b/resources/BuildResources/backports.list @@ -0,0 +1 @@ +deb http://ftp.debian.org/debian stretch-backports main diff --git a/resources/BuildResources/apt-preferences b/resources/BuildResources/backports.pref similarity index 56% rename from resources/BuildResources/apt-preferences rename to resources/BuildResources/backports.pref index 1900a88..4e72562 100644 --- a/resources/BuildResources/apt-preferences +++ b/resources/BuildResources/backports.pref @@ -3,11 +3,3 @@ Package: * Pin: release a=stretch-backports Pin-Priority: 450 - -Package: * -Pin: release a=testing -Pin-Priority: 400 - -Package: * -Pin: release a=unstable -Pin-Priority: 350 \ No newline at end of file diff --git a/resources/BuildResources/buster.list b/resources/BuildResources/buster.list new file mode 100644 index 0000000..45e5524 --- /dev/null +++ b/resources/BuildResources/buster.list @@ -0,0 +1,3 @@ +#Add buster to grab a functional firefox release +# /etc/apt/preferences prevents this from updating the whole system +deb http://deb.debian.org/debian/ buster main diff --git a/resources/BuildResources/buster.pref b/resources/BuildResources/buster.pref new file mode 100644 index 0000000..926d25d --- /dev/null +++ b/resources/BuildResources/buster.pref @@ -0,0 +1,5 @@ +#Stable (stretch) defaults to 500, and higher priorities are used over lower + +Package: * +Pin: release a=buster +Pin-Priority: 400 diff --git a/resources/BuildResources/sid.list b/resources/BuildResources/sid.list new file mode 100644 index 0000000..793304d --- /dev/null +++ b/resources/BuildResources/sid.list @@ -0,0 +1,3 @@ +#Add sid to grab a functional chromium release +# /etc/apt/preferences prevents this from updating the whole system +deb http://deb.debian.org/debian/ unstable main diff --git a/resources/BuildResources/sid.pref b/resources/BuildResources/sid.pref new file mode 100644 index 0000000..a38c2eb --- /dev/null +++ b/resources/BuildResources/sid.pref @@ -0,0 +1,5 @@ +#Stable (stretch) defaults to 500, and higher priorities are used over lower + +Package: * +Pin: release a=unstable +Pin-Priority: 350 \ No newline at end of file diff --git a/resources/BuildResources/sources.list b/resources/BuildResources/sources.list index 2b73263..9b52935 100644 --- a/resources/BuildResources/sources.list +++ b/resources/BuildResources/sources.list @@ -1,18 +1,2 @@ deb http://ftp.us.debian.org/debian stretch main deb-src http://ftp.us.debian.org/debian stretch main - -deb http://ftp.us.debian.org/debian stretch-updates main -deb-src http://ftp.us.debian.org/debian stretch-updates main - -deb http://security.debian.org/debian-security/ stretch/updates main -deb-src http://security.debian.org/debian-security/ stretch/updates main - -deb http://ftp.debian.org/debian stretch-backports main - -#Add buster to grab a functional firefox release -# /etc/apt/preferences prevents this from updating the whole system -deb http://deb.debian.org/debian/ testing main - -#Add sid to grab a functional chromium release -# /etc/apt/preferences prevents this from updating the whole system -deb http://deb.debian.org/debian/ unstable main \ No newline at end of file diff --git a/resources/BuildResources/updates.list b/resources/BuildResources/updates.list new file mode 100644 index 0000000..2062272 --- /dev/null +++ b/resources/BuildResources/updates.list @@ -0,0 +1,6 @@ + +deb http://ftp.us.debian.org/debian stretch-updates main +deb-src http://ftp.us.debian.org/debian stretch-updates main + +deb http://security.debian.org/debian-security/ stretch/updates main +deb-src http://security.debian.org/debian-security/ stretch/updates main diff --git a/scripts/InstallScripts/InstallPackages.sh b/scripts/InstallScripts/InstallPackages.sh index 3438354..4c1de05 100755 --- a/scripts/InstallScripts/InstallPackages.sh +++ b/scripts/InstallScripts/InstallPackages.sh @@ -40,8 +40,8 @@ DEBIAN_FRONTEND=noninteractive apt install -y network-manager-gnome network-mana # #install chromium from sid # apt -t unstable install -y chromium -# #install firefox from buster -DEBIAN_FRONTEND=noninteractive apt -t testing install -y firefox-esr +# #install firefox from buster (if buster repos are present, i.e. installed suite is less than bullseye), otherwise from default suite +DEBIAN_FRONTEND=noninteractive apt -t buster install -y firefox-esr || DEBIAN_FRONTEND=noninteractive apt install -y firefox-esr [ "$DE" = "xfce" ] && apt install -y xfce4 dbus-user-session system-config-printer tango-icon-theme xfce4-power-manager xfce4-terminal xfce4-goodies numix-gtk-theme plank accountsservice [ "$DE" = "lxqt" ] && apt install -y lxqt pavucontrol-qt diff --git a/scripts/buildFilesystem.sh b/scripts/buildFilesystem.sh index 6962ade..06df3c9 100755 --- a/scripts/buildFilesystem.sh +++ b/scripts/buildFilesystem.sh @@ -81,8 +81,14 @@ create_image() { mount -o noatime ${2}p2 $5 } +# use stretch if no suite is specified +if [ "$PRAWNOS_SUITE" = "" ] +then + PRAWNOS_SUITE=stretch +fi + # create a 2GB image with the Chrome OS partition layout -create_image PrawnOS-Alpha-c201-libre-2GB.img-BASE $outdev 50M 40 $outmnt +create_image PrawnOS-${PRAWNOS_SUITE}-Alpha-c201-libre-2GB.img-BASE $outdev 50M 40 $outmnt # use default debootstrap mirror if none is specified if [ "$PRAWNOS_DEBOOTSTRAP_MIRROR" = "" ] @@ -92,7 +98,7 @@ fi # install Debian on it export DEBIAN_FRONTEND=noninteractive -qemu-debootstrap --arch armhf stretch --include locales,init --keyring=$build_resources/debian-archive-keyring.gpg $outmnt $PRAWNOS_DEBOOTSTRAP_MIRROR +qemu-debootstrap --arch armhf $PRAWNOS_SUITE --include locales,init --keyring=$build_resources/debian-archive-keyring.gpg $outmnt $PRAWNOS_DEBOOTSTRAP_MIRROR chroot $outmnt passwd -d root @@ -116,8 +122,34 @@ chmod +x $outmnt/wifi-test.sh #This is what https://wiki.debian.org/EmDebian/CrossDebootstrap suggests cp /etc/hosts $outmnt/etc/ cp $build_resources/sources.list $outmnt/etc/apt/sources.list -#setup apt pinning -cp $build_resources/apt-preferences $outmnt/etc/apt/preferences +sed -i -e "s/stretch/$PRAWNOS_SUITE/g" $outmnt/etc/apt/sources.list +if [ "$PRAWNOS_SUITE" != "sid" ] +then + # sid doesn't have updates or security; they're present for all other suites + cat $build_resources/updates.list >> $outmnt/etc/apt/sources.list + sed -i -e "s/stretch/$PRAWNOS_SUITE/g" $outmnt/etc/apt/sources.list + # sid doesn't have backports; it's present for all other suites + cp $build_resources/backports.list $outmnt/etc/apt/sources.list.d/ + sed -i -e "s/stretch/$PRAWNOS_SUITE/g" $outmnt/etc/apt/sources.list.d/backports.list + #setup apt pinning + cp $build_resources/backports.pref $outmnt/etc/apt/preferences.d/ + sed -i -e "s/stretch/$PRAWNOS_SUITE/g" $outmnt/etc/apt/preferences.d/backports.pref +fi +if [ "$PRAWNOS_SUITE" = "stretch" ] +then + # Install buster as an additional source if the suite is less than buster + cp $build_resources/buster.list $outmnt/etc/apt/sources.list.d/ + #setup apt pinning + cp $build_resources/buster.pref $outmnt/etc/apt/preferences.d/ +fi +if [ "$PRAWNOS_SUITE" = "stretch" ] || [ "$PRAWNOS_SUITE" = "buster" ] +then + # Install sid as an additional source if the suite is less than bullseye. + # This should be replaced with bullseye after bullseye branches from sid. + cp $build_resources/sid.list $outmnt/etc/apt/sources.list.d/ + #setup apt pinning + cp $build_resources/sid.pref $outmnt/etc/apt/preferences.d/ +fi #Setup the locale cp $build_resources/locale.gen $outmnt/etc/locale.gen @@ -143,11 +175,23 @@ chroot $outmnt apt install -y libinput-tools xdotool build-essential chroot $outmnt apt-get install -y -d xorg acpi-support lightdm tasksel dpkg librsvg2-common xorg xserver-xorg-input-libinput alsa-utils anacron avahi-daemon eject iw libnss-mdns xdg-utils lxqt crda xfce4 dbus-user-session system-config-printer tango-icon-theme xfce4-power-manager xfce4-terminal xfce4-goodies mousepad vlc libutempter0 xterm numix-gtk-theme dconf-cli dconf-editor plank network-manager-gnome network-manager-openvpn network-manager-openvpn-gnome dtrx emacs25 accountsservice sudo pavucontrol-qt +if [ "$PRAWNOS_SUITE" = "stretch" ] +then + CHROMIUM_SUITE=buster +else + CHROMIUM_SUITE=$PRAWNOS_SUITE +fi # grab chromium as well, since sound is still broken in firefox for some media -chroot $outmnt apt-get -t testing install -d -y chromium +chroot $outmnt apt-get -t $CHROMIUM_SUITE install -d -y chromium -# #grab firefox from buster, since stretch is broken -chroot $outmnt apt-get -t testing install -d -y firefox-esr +if [ "$PRAWNOS_SUITE" = "stretch" ] +then + FIREFOX_SUITE=buster +else + FIREFOX_SUITE=$PRAWNOS_SUITE +fi +# #grab firefox from buster or higher, since stretch is broken +chroot $outmnt apt-get -t $FIREFOX_SUITE install -d -y firefox-esr #Cleanup hosts