瀏覽代碼

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
JeremyRand 5 年之前
父節點
當前提交
cbf2683420

+ 2 - 0
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`.
 
 

+ 5 - 2
makefile

@@ -14,7 +14,10 @@
 # along with PrawnOS.  If not, see <https://www.gnu.org/licenses/>.
 
 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

+ 1 - 0
resources/BuildResources/backports.list

@@ -0,0 +1 @@
+deb http://ftp.debian.org/debian stretch-backports main

+ 0 - 8
resources/BuildResources/apt-preferences → 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

+ 3 - 0
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

+ 5 - 0
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

+ 3 - 0
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

+ 5 - 0
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

+ 0 - 16
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

+ 6 - 0
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

+ 2 - 2
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

+ 51 - 7
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