-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to copy the image to a txt via ssh
- Loading branch information
Ralf Dragon
committed
Oct 16, 2024
1 parent
f220766
commit 06419b6
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
[[ $# == 1 ]] || { echo "$0 hostname"; exit 1; } | ||
|
||
txt=$1 | ||
|
||
files="am335x-kno_txt.dtb uImage rootfs.img" | ||
boot=/media/sdcard/boot | ||
|
||
read -s -p "Password for root@$txt?" p | ||
echo | ||
|
||
cd output/images/ | ||
|
||
echo "Preparing" | ||
export SSHPASS=$p | ||
sshpass -e ssh root@$txt mkdir -p $boot/new $boot/old | ||
|
||
echo "Copying" | ||
sshpass -e rsync -tv --progress $files root@$txt:$boot/new | ||
|
||
echo "Activating" | ||
sshpass -e ssh root@$txt "cd $boot && mv $files old && mv new/* ." | ||
echo "Success, rebooting" | ||
sshpass -e ssh root@$txt reboot |