External install script improvements

Rename it to make the name fit it's use
Add sd card support
update readme
This commit is contained in:
SolidHal 2018-10-24 16:22:45 -05:00
parent f182a5385a
commit 6e286215a4
4 changed files with 72 additions and 31 deletions

View File

@ -77,7 +77,7 @@ When it boots, login as root. The password is blank.
Make sure its the only storage device plugged in, and run this script to expand the partition and filesystem to the full usb drive
```
cd /InstallResources/
./InstallToUSB
./ExpandExternalInstall.sh
```
Congratulations: you are done! Welcome to PrawnOS. You should probably change the root password and make a user, but I'm not your boss or anything so I'll leave that to you.
If you want a quick guide on how to connect to wifi, check out [this down below](#connecting-to-wifi-in-a-basic-environment)
@ -89,7 +89,7 @@ Make sure you only have one usb or sd storage device plugged into the machine.
Run:
```
cd /InstallResources/
./InstallToUSB
./ExpandExternalInstall.sh
```
Then run this script which installs the either the xfce4 or the lxqt desktop enviroment, sound, trackpad, and Xorg configurations as well as prompts you to make a new user that automatically gets sudo privileges.

View File

@ -0,0 +1,65 @@
#!/bin/bash
#Expand PrawnOS to fill the entire external device
# This file is part of PrawnOS (http://www.prawnos.com)
# Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
# PrawnOS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
# PrawnOS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
while true; do
echo "This script will expand PrawnOS to fill the entire external"
echo " storage device it is booted from"
echo "If installing to a USB flash drive, make sure only one USB storage device is plugged in"
read -p "install to: internal external (S)D, external (U)SB Storage: " ESU
case $ESU in
[Ss]* ) TARGET=SD; break;;
[Uu]* ) TARGET=USB; break;;
* ) echo "Please answer S or U";;
esac
done
if [ "$TARGET" = "USB" ]
then
#Make the boot partition fille the whole drive
#Delete the partition
sgdisk -d 2 /dev/sda
#Make new partition map entry, with full size
sgdisk -N 2 /dev/sda
#Set the type to "data"
sgdisk -t 2:0700 /dev/sda
#Name is "properly" - Probably not required, but looks nice
sgdisk -c 2:Root /dev/sda
#Reload the partition mapping
partprobe /dev/sda
#Force the filesystem to fill the new partition
resize2fs -f /dev/sda2
fi
if [ "$TARGET" = "SD" ]
then
#Make the boot partition fille the whole drive
#Delete the partition
sgdisk -d 2 /dev/mmcblk0
#Make new partition map entry, with full size
sgdisk -N 2 /dev/mmcblk0
#Set the type to "data"
sgdisk -t 2:0700 /dev/mmcblk0
#Name is "properly" - Probably not required, but looks nice
sgdisk -c 2:Root /dev/mmcblk0
#Reload the partition mapping
partprobe /dev/mmcblk0
#Force the filesystem to fill the new partition
resize2fs -f /dev/mmcblk0p2
fi

View File

@ -25,18 +25,11 @@ read -p "This will ERASE ALL DATA ON THE INTERNAL STORAGE (EMMC) and reboot when
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo Writing partitions
#Wipe the partition tables
sgdisk -o -Z /dev/mmcblk2
# Make new partition table
sgdisk -g /dev/mmcblk2
#Get the last usable sector, cant just take last sector as we depend on the secondary gpt
LUS="$(sgdisk -p /dev/mmcblk2 | grep -o 'last usable sector is.*' | awk '{print $5}')"
#Now use that to find how bit the filesystem partition can be
MAX_SIZE="$(expr $LUS -20480 - 65536)"
# Make new entries
cgpt add -i 1 -b 20480 -s 65536 -t kernel -l KERNEL -S 1 -T 5 -P 10 /dev/mmcblk2
cgpt add -i 2 -b 86016 -s $MAX_SIZE -t data -l Root /dev/mmcblk2
#disable dmesg, writing the partition map tries to write the the first gpt table, which is unmodifiable
dmesg -D
echo Writing partition map
sfdisk /dev/mmcblk2 < $RESOURCES/mmc.partmap
dmesg -E
echo Writing kernel partition
dd if=/dev/sda1 of=/dev/mmcblk2p1
echo Writing Filesystem, this will take about 4 minutes...

View File

@ -1,17 +0,0 @@
#!/bin/bash
#Install PrawnOS to an external device, the first usb by default
#Make the boot partition fille the whole drive
#Delete the partition
sgdisk -d 2 /dev/sda
#Make new partition map entry, with full size
sgdisk -N 2 /dev/sda
#Set the type to "data"
sgdisk -t 2:0700 /dev/sda
#Name is "properly" - Probably not required, but looks nice
sgdisk -c 2:Root /dev/sda
#Reload the partition mapping
partprobe /dev/sda
#Force the filesystem to fill the new partition
resize2fs -f /dev/sda2