Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
White Rabbit Switch - Software
Manage
Activity
Members
Labels
Plan
Issues
99
Issue boards
Milestones
Wiki
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
White Rabbit Switch - Software
Commits
af971e84
Commit
af971e84
authored
1 year ago
by
Fabian Mauchle
Browse files
Options
Downloads
Patches
Plain Diff
[FEATURE
#190
] Save old ssh host keys and authorized_keys during firmware upgrade
and restore to new firwmare.
parent
62b4fe8d
2 merge requests
!4
preserve dot-config during firmware upgrade
,
!3
Resolve "Keep RSA/DSA key between reflash"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
userspace/rootfs_override/etc/init.d/wrs-boot-procedure
+29
-0
29 additions, 0 deletions
userspace/rootfs_override/etc/init.d/wrs-boot-procedure
with
29 additions
and
0 deletions
userspace/rootfs_override/etc/init.d/wrs-boot-procedure
+
29
−
0
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment