sonic-buildimage/files/image_config/platform/rc.local

47 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/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
if [ -n "$aboot_platform" ]; then
platform=$aboot_platform
elif [ -n "$onie_platform" ]; then
platform=$onie_platform
else
echo "Unknown sonic platform"
2017-04-21 19:23:36 -05:00
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
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
fi
2017-04-21 19:23:36 -05:00
rm /host/image-$sonic_version/platform/firsttime
fi
exit 0