mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-26 00:41:04 +01:00
Optimized sed
This commit is contained in:
parent
faf8239918
commit
f51eaa12e6
@ -423,7 +423,7 @@ if [ "$encrypt_system" == "y" ]
|
|||||||
crypttab_rescue_path="$crypttab_path$rescue_suffix"
|
crypttab_rescue_path="$crypttab_path$rescue_suffix"
|
||||||
boot_txt_path="/boot/boot.txt"
|
boot_txt_path="/boot/boot.txt"
|
||||||
boot_txt_rescue_path="/boot/boot.txt$rescue_suffix"
|
boot_txt_rescue_path="/boot/boot.txt$rescue_suffix"
|
||||||
boot_txt_uncomment_line="part uuid ${devtype} ${devnum}:2 uuid"
|
boot_txt_delete_line=$(echo "part uuid \${devtype} \${devnum}:2 uuid" | sed -e 's/[]\/$*.^[]/\\&/g')
|
||||||
boot_txt_setenv_origin=$(echo "setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=\${uuid} rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" | sed -e 's/[]\/$*.^[]/\\&/g')
|
boot_txt_setenv_origin=$(echo "setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=\${uuid} rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\"" | sed -e 's/[]\/$*.^[]/\\&/g')
|
||||||
boot_txt_setenv_replace=$(echo "setenv bootargs console=ttyS1,115200 console=tty0 ip=::::$target_hostname:eth0:dhcp cryptdevice=$encrypted_partition_path:root root=$root_mapper_path rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\""| sed -e 's/[\/&]/\\&/g')
|
boot_txt_setenv_replace=$(echo "setenv bootargs console=ttyS1,115200 console=tty0 ip=::::$target_hostname:eth0:dhcp cryptdevice=$encrypted_partition_path:root root=$root_mapper_path rw rootwait smsc95xx.macaddr=\"\${usbethaddr}\""| sed -e 's/[\/&]/\\&/g')
|
||||||
info "Setup encryption..." &&
|
info "Setup encryption..." &&
|
||||||
@ -443,12 +443,15 @@ if [ "$encrypt_system" == "y" ]
|
|||||||
echo "mount $root_mapper_path /mnt"
|
echo "mount $root_mapper_path /mnt"
|
||||||
echo "rsync --info=progress2 -axHAX / /mnt/"
|
echo "rsync --info=progress2 -axHAX / /mnt/"
|
||||||
echo "cp -v $fstab_path $fstab_rescue_path"
|
echo "cp -v $fstab_path $fstab_rescue_path"
|
||||||
echo "echo '$root_mapper_path / ext4 defaults,noatime 0 1' >> $fstab_path"
|
echo "echo '$root_mapper_path / ext4 defaults,noatime 0 1' >> $fstab_path"
|
||||||
|
echo "echo \"$fstab_path:\" && cat \"$fstab_path\""
|
||||||
echo "cp -v $crypttab_path $crypttab_rescue_path"
|
echo "cp -v $crypttab_path $crypttab_rescue_path"
|
||||||
echo "echo 'root $encrypted_partition_path none luks' >> $crypttab_path"
|
echo "echo 'root $encrypted_partition_path none luks' >> $crypttab_path"
|
||||||
|
echo "echo \"$crypttab_path:\" && cat \"$crypttab_path\""
|
||||||
echo "cp -v $boot_txt_path $boot_txt_rescue_path"
|
echo "cp -v $boot_txt_path $boot_txt_rescue_path"
|
||||||
echo "sed -i 's/$boot_txt_uncomment_line/#$boot_txt_uncomment_line/g' $boot_txt_path" #@todo doesn't work yet
|
echo "sed -i 's/$boot_txt_delete_line//g' $boot_txt_path" #@todo doesn't work yet
|
||||||
echo "sed -i 's/$boot_txt_setenv_origin/$boot_txt_setenv_replace/g' $boot_txt_path" #@todo doesn't work yet
|
echo "sed -i 's/$boot_txt_setenv_origin/$boot_txt_setenv_replace/g' $boot_txt_path" #@todo doesn't work yet
|
||||||
|
echo "echo \"$boot_txt_path:\" && cat \"$boot_txt_path\""
|
||||||
echo "cd /boot/ && ./mkscr"
|
echo "cd /boot/ && ./mkscr"
|
||||||
echo "exit"
|
echo "exit"
|
||||||
) | chroot "$root_mount_path" /bin/bash || error
|
) | chroot "$root_mount_path" /bin/bash || error
|
||||||
|
Loading…
Reference in New Issue
Block a user