Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
af971e84
Commit
af971e84
authored
Sep 27, 2023
by
Fabian Mauchle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEATURE
#190
] Save old ssh host keys and authorized_keys during firmware upgrade
and restore to new firwmare.
parent
62b4fe8d
Pipeline
#4900
failed with stage
in 7 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
wrs-boot-procedure
userspace/rootfs_override/etc/init.d/wrs-boot-procedure
+29
-0
No files found.
userspace/rootfs_override/etc/init.d/wrs-boot-procedure
View file @
af971e84
...
...
@@ -182,7 +182,25 @@ fi
# First: update usr: we may have the whole thing, or just wrs-usr.tar.gz
if
[
-f
/update/
$WRS_FW
-o
-f
/update/
$WRS_USR
]
;
then
echo
-n
"Saving existing data..."
|
$TEE
/dev/ttyGS0
# Mount /usr temporarily to transfer some existing files
mkdir
-p
/usr
mount
-t
ubifs ubi0:usr /usr
# save some old data to be reused with updated software
if
ls
/usr/etc/ssh/ssh_host_
*
_key
*
1> /dev/null 2>&1
;
then
cp
/usr/etc/ssh/ssh_host_
*
_key
*
/tmp/
fi
if
[
-f
/usr/authorized_keys
]
;
then
cp
/usr/authorized_keys /tmp/
fi
# FIXME: save configuration somewhere, and recover it later
# Unmount /usr again so we can recreate the partition form the new firmware
sync
;
cd
/
;
umount /usr
echo
" done"
|
$TEE
/dev/ttyGS0
echo
-n
"Extracting filesystem..."
|
$TEE
/dev/ttyGS0
# since we are upgrading, we'd better remove and recreate the volume
ubirmvol /dev/ubi0
--name
=
usr
...
...
@@ -195,6 +213,17 @@ if [ -f /update/$WRS_FW -o -f /update/$WRS_USR ]; then
else
tar
xzf /update/
$WRS_USR
fi
echo
" done"
|
$TEE
/dev/ttyGS0
# restore saved data
echo
-n
"Restoring saved data..."
|
$TEE
/dev/ttyGS0
if
ls
/tmp/ssh_host_
*
_key
*
1> /dev/null 2>&1
;
then
mv
/tmp/ssh_host_
*
_key
*
/usr/etc/ssh/
fi
if
[
-f
/tmp/authorized_keys
]
;
then
mv
/tmp/authorized_keys /usr/
fi
sync
;
cd
/
;
umount /usr
echo
" done"
|
$TEE
/dev/ttyGS0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment