2017-02-27 15:08:41 -06:00
|
|
|
#!/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"
|
|
|
|
|
2017-04-21 19:23:36 -05:00
|
|
|
sonic_version=$(cat /etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d" ")
|
|
|
|
|
|
|
|
if [ -f /host/image-$sonic_version/platform/firsttime ]; then
|
2017-03-01 19:05:13 -06:00
|
|
|
|
2017-03-02 12:10:40 -06:00
|
|
|
if [ -n "$aboot_platform" ]; then
|
2017-03-01 19:05:13 -06:00
|
|
|
platform=$aboot_platform
|
2017-03-02 12:10:40 -06:00
|
|
|
elif [ -n "$onie_platform" ]; then
|
2017-03-01 19:05:13 -06:00
|
|
|
platform=$onie_platform
|
|
|
|
else
|
|
|
|
echo "Unknown sonic platform"
|
2017-04-21 19:23:36 -05:00
|
|
|
rm /host/image-$sonic_version/platform/firsttime
|
2017-03-01 19:05:13 -06:00
|
|
|
exit 0
|
2017-02-27 15:08:41 -06:00
|
|
|
fi
|
2017-03-01 19:05:13 -06:00
|
|
|
|
2017-04-26 03:41:18 -05:00
|
|
|
# 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
|
2017-03-01 19:05:13 -06:00
|
|
|
|
2017-04-21 19:23:36 -05:00
|
|
|
if [ -d /host/image-$sonic_version/platform/$platform ]; then
|
|
|
|
dpkg -i /host/image-$sonic_version/platform/$platform/*.deb
|
2017-03-01 19:05:13 -06:00
|
|
|
fi
|
|
|
|
|
2017-04-21 19:23:36 -05:00
|
|
|
rm /host/image-$sonic_version/platform/firsttime
|
2017-02-27 15:08:41 -06:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|