mirror of
https://codeberg.org/B3rtl/Ubuntu-Setup-Skripte
synced 2024-06-06 18:46:24 +02:00
rework the script to work as non-root and original ISO is used as argument instead
This commit is contained in:
parent
7c5ad3ffbc
commit
cac50cd166
|
@ -1,38 +1,39 @@
|
|||
#!/bin/bash
|
||||
#you need to download the latest Linux Mint ISO from the website first before running the script.
|
||||
|
||||
#the script needs superuser rights to work correctly for now.
|
||||
#TO DO: maybe there is a way for the script to work as non-root?
|
||||
[[ $UID -ne 0 ]] && exec sudo ./"$0"
|
||||
#adds a variable for correct naming of the created ISO.
|
||||
UNATTENDED="unattended-$1" # => unattended-linuxmint-19.3-cinnamon-64bit.iso
|
||||
|
||||
#creates some folders that are used during the process. These can be changed, but needed be to changed across the script.
|
||||
mkdir /mnt/iso /opt/mintiso
|
||||
#catch if argument 1 is empty. Without the ISO as an argument this script won't work
|
||||
if [ -z "$1" ]
|
||||
|
||||
#Downloads latest* mint-iso from the fh-aachen mirror.
|
||||
#TO DO: Maybe there is a way to use a more generic url here? As it stands now the url has to be changed when a new Linux Mint version is released down the line. Maybe variables are a possibility?
|
||||
wget http://mirror.bauhuette.fh-aachen.de/linuxmint-cd/stable/19.3/linuxmint-19.3-cinnamon-64bit.iso
|
||||
then echo "Usage: $0 [linuxmint-original.iso]"
|
||||
exit
|
||||
|
||||
#mounts the downloaded iso into a folder. * is added as a wildcard for the version number.
|
||||
mount -o loop linuxmint-*-cinnamon-64bit.iso /mnt/iso
|
||||
#catch if the file cannot be found or is misspelled.
|
||||
elif [[ ! -f $1 ]]; then
|
||||
echo "File not found: $1" >&2
|
||||
exit 1
|
||||
|
||||
#the contents of the iso have to be copied over to another folder, since the ISO is mounted read-only. all the steps below require root.
|
||||
cp -rT /mnt/iso/ /opt/mintiso/
|
||||
cd /opt/mintiso/
|
||||
else
|
||||
|
||||
#copies the computertruhe.seed from codeberg-repo so always the latest preseed-file is used.
|
||||
curl https://codeberg.org/stefan230/Setup-Skripte/raw/branch/master/mint/computertruhe.seed > /opt/mintiso/preseed/computertruhe.seed
|
||||
#creates a folders that is used during the process.
|
||||
mkdir iso
|
||||
|
||||
#configures the bootloader to use the "custom" computertruhe-preseed.
|
||||
sed -i 's/linuxmint.seed/computertruhe.seed/g' isolinux/isolinux.cfg
|
||||
#copies the iso to the created folder and makes the installed files writable.
|
||||
bsdtar -xf $1 -C ./iso
|
||||
chmod -R u+w ./iso
|
||||
|
||||
#copies the computertruhe.seed from codeberg-repo so always the latest preseed-file is used.
|
||||
curl https://codeberg.org/Computertruhe/Setup-Skripte/raw/branch/master/mint/computertruhe.seed > ./iso/preseed/linuxmint.seed
|
||||
|
||||
#creates the custom-iso with the given parameters.
|
||||
#TO DO: the outputpath right now is not generic enough. Maybe find a better name for the iso.
|
||||
mkisofs -D -r -V "UNATTENDED_MINT" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /home/stefan/linuxmint-unattended.iso /opt/mintiso
|
||||
mkisofs -D -r -V "UNATTENDED_MINT" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o $UNATTENDED ./iso
|
||||
|
||||
#umounts the iso and clears up the space we used to create the iso.
|
||||
umount /mnt/iso
|
||||
cd
|
||||
rm -r /mnt/iso/
|
||||
rm -r /opt/mintiso/
|
||||
rm -rf ./iso
|
||||
|
||||
#from here we are basically done and the iso can be "burned" on an USB ready for install.
|
||||
echo "Die Custom ISO wurde fertiggestellt und kann nun verwendet werden. Die ISO ist unter /home/stefan/linuxmint-unattended.iso zu finden."
|
||||
#from here we are basically done and the iso can be "burned" on an USB ready for install.
|
||||
echo "Die Custom ISO wurde fertiggestellt und kann nun verwendet werden. Die ISO ist unter $UNATTENDED zu finden."
|
||||
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue