|
@@ -6,37 +6,31 @@
|
|
|
KVER=4.17.2
|
|
|
|
|
|
#Ensure Sudo
|
|
|
-if [[ $UID != 0 ]]; then
|
|
|
- echo "Please run this script with sudo:"
|
|
|
+if [ ! $UID = "0" ]
|
|
|
+then
|
|
|
+ echo "Please run this script with sudo, or as root:"
|
|
|
echo "sudo $0 $*"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
outmnt=$(mktemp -d -p `pwd`)
|
|
|
-inmnt=$(mktemp -d -p `pwd`)
|
|
|
|
|
|
outdev=/dev/loop4
|
|
|
-indev=/dev/loop5
|
|
|
+
|
|
|
+install_resources=resources/InstallResources
|
|
|
+build_resources=resources/BuildResources
|
|
|
|
|
|
#A hacky way to ensure the loops are properly unmounted and the temp files are properly deleted.
|
|
|
#Without this, a reboot is sometimes required to properly clean the loop devices and ensure a clean build
|
|
|
cleanup() {
|
|
|
set +e
|
|
|
|
|
|
- umount -l $inmnt > /dev/null 2>&1
|
|
|
- rmdir $inmnt > /dev/null 2>&1
|
|
|
- losetup -d $indev > /dev/null 2>&1
|
|
|
-
|
|
|
umount -l $outmnt > /dev/null 2>&1
|
|
|
rmdir $outmnt > /dev/null 2>&1
|
|
|
losetup -d $outdev > /dev/null 2>&1
|
|
|
|
|
|
set +e
|
|
|
|
|
|
- umount -l $inmnt > /dev/null 2>&1
|
|
|
- rmdir $inmnt > /dev/null 2>&1
|
|
|
- losetup -d $indev > /dev/null 2>&1
|
|
|
-
|
|
|
umount -l $outmnt > /dev/null 2>&1
|
|
|
rmdir $outmnt > /dev/null 2>&1
|
|
|
losetup -d $outdev > /dev/null 2>&1
|
|
@@ -64,7 +58,7 @@ create_image() {
|
|
|
}
|
|
|
|
|
|
# create a 2GB image with the Chrome OS partition layout
|
|
|
-create_image librean-stretch-c201-libre-2GB.img $outdev 50M 40 $outmnt
|
|
|
+create_image PrawnOS-Alpha-c201-libre-2GB.img $outdev 50M 40 $outmnt
|
|
|
|
|
|
# install Debian on it
|
|
|
export LC_ALL="en_US.UTF-8" #Change this as necessary if not US
|
|
@@ -73,18 +67,18 @@ qemu-debootstrap --arch armhf stretch --include locales,init $outmnt http://deb.
|
|
|
chroot $outmnt passwd -d root
|
|
|
|
|
|
#Place the config files and installer script and give them the proper permissions
|
|
|
-echo -n librean > $outmnt/etc/hostname
|
|
|
-cp -R os_configs/ $outmnt/os_configs/
|
|
|
-cp Install.sh $outmnt/Install.sh
|
|
|
-chmod +x $outmnt/os_configs/sound.sh
|
|
|
-chmod +x $outmnt/Install.sh
|
|
|
+echo -n PrawnOS-Alpha > $outmnt/etc/hostname
|
|
|
+cp -R $install_resources/ $outmnt/InstallResources/
|
|
|
+cp scripts/InstallScripts/* $outmnt/InstallResources/
|
|
|
+cp scripts/InstallScripts/InstallToInternal.sh $outmnt/
|
|
|
+chmod +x $outmnt/*.sh
|
|
|
|
|
|
-#install -D -m 644 80disable-recommends $outmnt/etc/apt/apt.conf.d/80disable-recommends #This should fix the issue of crda being installed but unconfigured causing regulatory.db firmware loading errors in dmesg
|
|
|
+install -D -m 644 $build_resources/80disable-recommends $outmnt/etc/apt/apt.conf.d/80disable-recommends #This should fix the issue of crda being installed but unconfigured causing regulatory.db firmware loading errors in dmesg
|
|
|
|
|
|
#Setup the chroot for apt
|
|
|
#This is what https://wiki.debian.org/EmDebian/CrossDebootstrap suggests
|
|
|
cp /etc/hosts $outmnt/etc/
|
|
|
-cp sources.list $outmount/etc/apt/sources.list
|
|
|
+cp $build_resources/sources.list $outmount/etc/apt/sources.list
|
|
|
|
|
|
#Setup the locale
|
|
|
cp /etc/locale.gen $outmnt/etc/
|
|
@@ -98,33 +92,19 @@ chroot $outmnt apt-get autoremove --purge
|
|
|
chroot $outmnt apt-get clean
|
|
|
|
|
|
#Download the packages to be installed by Install.sh: TODO: potentially dpkg-reconfigure locales?
|
|
|
-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 wicd-daemon wicd wicd-curses wicd-gtk xserver-xorg-input-synaptics
|
|
|
+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 wicd-daemon wicd wicd-curses wicd-gtk xserver-xorg-input-synaptics crda
|
|
|
|
|
|
#Cleanup hosts
|
|
|
rm -rf $outmnt/etc/hosts #This is what https://wiki.debian.org/EmDebian/CrossDebootstrap suggests
|
|
|
-echo -n "127.0.0.1 librean" > $outmnt/etc/hosts
|
|
|
+echo -n "127.0.0.1 PrawnOS-Alpha" > $outmnt/etc/hosts
|
|
|
|
|
|
# put the kernel in the kernel partition, modules in /lib/modules and AR9271
|
|
|
# firmware in /lib/firmware
|
|
|
-dd if=linux-$KVER/vmlinux.kpart of=${outdev}p1 conv=notrunc
|
|
|
-make -C linux-$KVER ARCH=arm INSTALL_MOD_PATH=$outmnt modules_install
|
|
|
+dd if=build/linux-$KVER/vmlinux.kpart of=${outdev}p1 conv=notrunc
|
|
|
+make -C build/linux-$KVER ARCH=arm INSTALL_MOD_PATH=$outmnt modules_install
|
|
|
rm -f $outmnt/lib/modules/3.14.0/{build,source}
|
|
|
-install -D -m 644 open-ath9k-htc-firmware/target_firmware/htc_9271.fw $outmnt/lib/firmware/ath9k_htc/htc_9271-1.4.0.fw
|
|
|
-
|
|
|
-# create a 15GB image
|
|
|
-create_image librean-stretch-c201-libre-15GB.img $indev 512 30777343 $inmnt
|
|
|
-
|
|
|
-# copy the kernel and / of the 2GB image to the 15GB one
|
|
|
-dd if=${outdev}p1 of=${indev}p1 conv=notrunc
|
|
|
-cp -a $outmnt/* $inmnt/
|
|
|
-
|
|
|
-#Cleanup the 15GB image
|
|
|
-umount -l $inmnt
|
|
|
-rmdir $inmnt
|
|
|
-losetup -d $indev
|
|
|
+install -D -m 644 build/open-ath9k-htc-firmware/target_firmware/htc_9271.fw $outmnt/lib/firmware/ath9k_htc/htc_9271-1.4.0.fw
|
|
|
|
|
|
-# move the 15GB image inside the 2GB one
|
|
|
-cp -f librean-stretch-c201-libre-15GB.img $outmnt/
|
|
|
echo "DONE!"
|
|
|
cleanup
|
|
|
|