mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-21 14:41:04 +01:00
Implemented transfering of manjaro isos
This commit is contained in:
parent
e25b75a873
commit
f1349be5c0
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
decrypted/
|
||||
.encrypted/
|
||||
*package-lock.json
|
||||
log.txt
|
||||
|
26
README.md
26
README.md
@ -83,18 +83,22 @@ To pase the configuration to the program use this syntax:
|
||||
```bash
|
||||
(
|
||||
echo "$USER" # | The username
|
||||
echo "mmcblk1" # | The device
|
||||
echo "3" # | The raspberry pi number
|
||||
echo "arch" # | The operation system
|
||||
echo "sdX" # | The device
|
||||
echo "64_bit" # | The architecture type; arm or 64_bit
|
||||
echo "manjaro" # | The operation system
|
||||
echo "architect" # | The version
|
||||
#echo "n" # ├── If arch: Should a encrypted setup be used? (y/n)
|
||||
echo "n" # | Force image download
|
||||
echo "n" # | Transfer image
|
||||
#echo "n" # ├── If image transfer yes Overwrite device before copying? (y/n)
|
||||
echo "test12345" # | The user password
|
||||
echo "test12345" # | The root password
|
||||
echo "example-host" # | The hostname
|
||||
echo "y" # | Setup Wifi on target system
|
||||
)| sudo bash ./scripts/image/setup.sh
|
||||
echo "n" # | Should the image download be forced?(y/n)
|
||||
echo "y" # | Should the image be transfered to $device_path?(y/n)
|
||||
echo "n" # ├── Overwrite device before copying? (y/n)
|
||||
echo "n" # | Should the ssh-key be copied to the image?(y/N)
|
||||
#echo "test12345" # ├── The user password_1
|
||||
#echo "test12345" # ├── The user password_2
|
||||
echo "n" # | Should the ssh-key be copied to the image?(y/N)
|
||||
echo "n" # |Should the hostname be changed?(y/N)
|
||||
#echo "example-host" # | The hostname
|
||||
#echo "y" # | Setup Wifi on target system - Not implemented yet
|
||||
)| sudo bash ./scripts/image/setup.sh | tee log.txt
|
||||
```
|
||||
|
||||
## License
|
||||
|
@ -82,7 +82,7 @@ case "$architecture" in
|
||||
;;
|
||||
"64_bit")
|
||||
case "$os" in
|
||||
"arm")
|
||||
"manjaro")
|
||||
echo "1) architect"
|
||||
;;
|
||||
*)
|
||||
@ -122,7 +122,7 @@ case "$os" in
|
||||
case "$version" in
|
||||
"architect")
|
||||
image_checksum="6b1c2fce12f244c1e32212767a9d3af2cf8263b2"
|
||||
base_download_url="https://osdn.net/frs/redir.php?m=dotsrc&f=%2Fstorage%2Fg%2Fm%2Fma%2Fmanjaro%2Farchitect%2F20.0%2Fmanjaro-architect-20.0-200426-linux56.iso";
|
||||
base_download_url="https://osdn.net/frs/redir.php?m=dotsrc&f=%2Fstorage%2Fg%2Fm%2Fma%2Fmanjaro%2Farchitect%2F20.0%2F";
|
||||
imagename="manjaro-architect-20.0-200426-linux56.iso"
|
||||
;;
|
||||
*)
|
||||
@ -171,7 +171,7 @@ if [ "$force_image_download" = "y" ]
|
||||
then
|
||||
if [ -f "$image_path" ]
|
||||
then
|
||||
info "Removing image $image_path."
|
||||
info "Removing image $image_path." &&
|
||||
rm "$image_path" || error "Removing image \"$image_path\" failed."
|
||||
else
|
||||
info "Forcing download wasn't neccessary. File $image_path doesn't exist."
|
||||
@ -185,7 +185,7 @@ if [ -f "$image_path" ]
|
||||
else
|
||||
info "Image \"$imagename\" doesn't exist under local path \"$image_path\"."
|
||||
info "Image \"$imagename\" gets downloaded from \"$download_url\"..."
|
||||
wget "$download_url" -P "$image_folder" || error "Download from \"$download_url\" failed."
|
||||
wget "$download_url" -O "$image_path" || error "Download from \"$download_url\" failed."
|
||||
fi
|
||||
|
||||
info "Verifying image..."
|
||||
@ -202,6 +202,10 @@ make_mount_folders
|
||||
|
||||
set_partition_paths
|
||||
|
||||
# @see https://www.heise.de/ct/hotline/Optimale-Blockgroesse-fuer-dd-2056768.html
|
||||
optimal_blocksize=$(expr 64 \* "$(sudo cat /sys/block/$device/queue/physical_block_size)") &&
|
||||
info "Calculated optimal blocksize of $optimal_blocksize""Byte for \"dd\" operations."
|
||||
|
||||
question "Should the image be transfered to $device_path?(y/n)" && read -r transfer_image
|
||||
if [ "$transfer_image" = "y" ]
|
||||
then
|
||||
@ -210,7 +214,7 @@ if [ "$transfer_image" = "y" ]
|
||||
if [ "$copy_zeros_to_device" = "y" ]
|
||||
then
|
||||
info "Overwritting..." &&
|
||||
dd if=/dev/zero of="$device_path" bs=1M || error "Overwritting $device_path failed."
|
||||
dd if=/dev/zero of="$device_path" bs="$optimal_blocksize" || error "Overwritting $device_path failed."
|
||||
else
|
||||
info "Skipping Overwritting..."
|
||||
fi
|
||||
@ -252,25 +256,27 @@ if [ "$transfer_image" = "y" ]
|
||||
info "Boot files will be transfered to device..." &&
|
||||
mv -v "$root_mount_path/boot/"* "$boot_mount_path" ||
|
||||
error
|
||||
elif [${image_path: -4} = ".zip" ]
|
||||
elif [ "${image_path: -4}" = ".zip" ]
|
||||
then
|
||||
unzip -p "$image_path" | sudo dd of="$device_path" bs=1M conv=fsync || error "DD $image_path to $device_path failed." &&
|
||||
info "Transfering .zip file..." &&
|
||||
unzip -p "$image_path" | sudo dd of="$device_path" bs="$optimal_blocksize" conv=fsync || error "DD $image_path to $device_path failed." &&
|
||||
sync ||
|
||||
error
|
||||
elif [${image_path: -3} = ".gz" ]
|
||||
elif [ "${image_path: -3}" = ".gz" ]
|
||||
then
|
||||
gunzip -c "$image_path" | sudo dd of="$device_path" bs=1M conv=fsync &&
|
||||
info "Transfering .gz file..." &&
|
||||
gunzip -c "$image_path" | sudo dd of="$device_path" bs="$optimal_blocksize" conv=fsync &&
|
||||
sync ||
|
||||
error
|
||||
elif [${image_path: -4} = ".iso" ]
|
||||
elif [ "${image_path: -4}" = ".iso" ]
|
||||
then
|
||||
sudo dd of="$device_path" bs=1M conv=fsync &&
|
||||
info "Transfering .iso file..." &&
|
||||
sudo dd if="$image_path" of="$device_path" bs="$optimal_blocksize" conv=fsync &&
|
||||
sync ||
|
||||
error
|
||||
else
|
||||
error "Image transfer for operation system \"$os\" is not supported yet!";
|
||||
fi
|
||||
esac
|
||||
else
|
||||
info "Skipping image transfer..."
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user