d597418b6c
* [rc.local]: Copy saved minigraph if available. In case of sonic-to-sonic update old image stores minigraph under /host directory. Upon first boot this minigraph will be used by new image to save configuration. Signed-off-by: marian-pritsak <marianp@mellanox.com>
47 lines
1.2 KiB
Bash
Executable File
47 lines
1.2 KiB
Bash
Executable File
#!/bin/sh -e
|
|
#
|
|
# rc.local
|
|
#
|
|
# This script is executed at the end of each multiuser runlevel.
|
|
# Make sure that the script will "exit 0" on success or any other
|
|
# value on error.
|
|
#
|
|
# In order to enable or disable this script just change the execution
|
|
# bits.
|
|
#
|
|
# By default this script does nothing.
|
|
|
|
. /host/machine.conf
|
|
|
|
echo "install platform dependent packages at the first boot time"
|
|
|
|
sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ")
|
|
|
|
if [ -f /host/image-$sonic_version/platform/firsttime ]; then
|
|
|
|
if [ -n "$aboot_platform" ]; then
|
|
platform=$aboot_platform
|
|
elif [ -n "$onie_platform" ]; then
|
|
platform=$onie_platform
|
|
else
|
|
echo "Unknown sonic platform"
|
|
rm /host/image-$sonic_version/platform/firsttime
|
|
exit 0
|
|
fi
|
|
|
|
# Try to take minigraph saved during installation
|
|
if [ -f /host/minigraph.xml ]; then
|
|
mv /host/minigraph.xml /etc/sonic/
|
|
else
|
|
cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/
|
|
fi
|
|
|
|
if [ -d /host/image-$sonic_version/platform/$platform ]; then
|
|
dpkg -i /host/image-$sonic_version/platform/$platform/*.deb
|
|
fi
|
|
|
|
rm /host/image-$sonic_version/platform/firsttime
|
|
fi
|
|
|
|
exit 0
|