Following the topic Difficulties installing EasyOS and some suggestions, I believe a script to automate the creation of an easyos folder containing the initrd, vmlinuz and easy.sfs files in a partition for installation on an internal hard drive a PC would be useful. The script would be launched from an Easy USB key.
I suggest that we (EasyOS users) collaborate to write it, as my bash knowledge and skills are limited
First ideas :
The script would take as argument the partition where we want to create the folder. The partition would be previously mounted (by EasyOS on the key)
$1 is the first (and only) argument, i.e. the chosen partition (e.g. sdb2)
Testing the existence of /mnt/$1:
Code: Select all
PARTCHOSEN=$1
if [ ! -d "/mnt/PARTCHOSEN" ] ; then
echo "The partition does not exist or it is not mounted"
exit 1
fi
EDIT : Very bad, not work !
Checking that $1 is an ext4 partition:
??????
EDIT : the command lsblk -n -o FSTYPE /dev/PARTCHOSEN displays the filesystem type of /dev/$1
creation of the easyos folder:
Code: Select all
mkdir /mnt/PARTCHOSEN/easyos
if [$? = 1 ] ; then
exit
fi
EDIT : the character $ is missing in this code
copy the initrd and wmlinuz files to the easyos folder:
Code: Select all
cp /mnt/wkg/initrd /mnt/PARTCHOSEN/easyos
cp /mnt/wkg/vmlinuz /mnt/PARTCHOSEN/easyos
EDIT : the character $ is missing in this code
copy of easy.sfs in easyos:
EDIT First try, Bad idea, it will generate an error if the version of EasyOS in use on the stick is not the last version installed.
(These commands are based on lines 1532 and following of the init script)
Code: Select all
VERS="$(ls -l -d /mnt/wkg/releases/easy-* | rev | cut -f 1 -d '-' | rev)"
sortedVERS="$(echo "$VERS" | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n)" #lowest to highest.
for LASTVERS in echo "$sortedVERS" | tail -n -1 | tr '\n' ' '`
do
cp /mnt/wkg/sfs/easyos/oe/kirstone/easy_${LASTVERS}_amd64.sfs /mnt/PARTCHOSEN/easys.sfs
done
EDIT New try :
Code: Select all
. /etc/lsb-release # retrieve the variable DISTRIB_RELEASE
cp /mnt/wkg/sfs/easyos/oe/kirstone/easy_${DISTRIB_RELEASE}_amd64.sfs /mnt/PARTCHOSEN/easys.sfs
EDIT : $PARTCHOSEN/easyos/ instead of PARTCHOSEN/
EDIT : it's easy.sfs, not easys.sfs
Thanks for your help