Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • project/wr-switch-sw
1 result
Show changes
Commits on Source (1)
......@@ -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
......