[arkdep] Replace sed with bash buildins
This commit is contained in:
parent
a91c398b6b
commit
212919594f
1 changed files with 16 additions and 1 deletions
17
arkdep
17
arkdep
|
@ -868,7 +868,22 @@ deploy () {
|
||||||
# Deploy bootloader configuration
|
# Deploy bootloader configuration
|
||||||
# also insert newline
|
# also insert newline
|
||||||
printf '\n\e[1;34m-->\e[0m\e[1m Adding bootloader entry\e[0m\n'
|
printf '\n\e[1;34m-->\e[0m\e[1m Adding bootloader entry\e[0m\n'
|
||||||
sed "s/%target%/${data[0]}/" $arkdep_dir/templates/systemd-boot > $arkdep_boot/loader/entries/${data[0]}.conf
|
|
||||||
|
# Ensure bootloader entry is not already present, if it us replace it
|
||||||
|
if [[ -f $arkdep_boot/loader/entries/${data[0]}.conf ]]; then
|
||||||
|
printf "\e[1;33m<!>\e[0m\e[1m A bootloader entry for ${data[0]} is already installed, bootloader entry will be regenerated\e[0m\n"
|
||||||
|
rm $arkdep_boot/loader/entries/${data[0]}.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load systemd-boot template in to list
|
||||||
|
mapfile systemd_boot_template < $arkdep_dir/templates/systemd-boot ||
|
||||||
|
cleanup_and_quit 'Failed to read systemd-boot template file'
|
||||||
|
|
||||||
|
# Write bootloader entry
|
||||||
|
for line in "${systemd_boot_template[@]}"; do
|
||||||
|
echo ${line/\%target\%/${data[0]}} >> $arkdep_boot/loader/entries/${data[0]}.conf ||
|
||||||
|
cleanup_and_quit 'Failed to write systemd-boot entry'
|
||||||
|
done
|
||||||
|
|
||||||
# Set new deployment as default bootloader entry
|
# Set new deployment as default bootloader entry
|
||||||
printf '\e[1;34m-->\e[0m\e[1m Setting new bootloader entry as default\e[0m\n'
|
printf '\e[1;34m-->\e[0m\e[1m Setting new bootloader entry as default\e[0m\n'
|
||||||
|
|
Loading…
Add table
Reference in a new issue