2d3b064437
1. "make target/sonic-broadcom.raw" will create the compressed dd'able image. 2. This will also update the grub config files (device/dell/*/nos_to_sonic_grub.cfg) with the image versions.
83 lines
2.8 KiB
Bash
Executable File
83 lines
2.8 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.
|
|
|
|
# If the machine.conf is absent, it indicates that the unit booted
|
|
# into SONiC from another NOS. Extract the machine.conf from ONIE.
|
|
if [ ! -e /host/machine.conf ]; then
|
|
onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//')
|
|
mkdir -p /mnt/onie-boot
|
|
mount $onie_dev /mnt/onie-boot
|
|
onie_grub_cfg=/mnt/onie-boot/onie/grub/grub-machine.cfg
|
|
|
|
if [ ! -e $onie_grub_cfg ]; then
|
|
echo "$onie_grub_cfg not found" >> /etc/migration.log
|
|
else
|
|
. ./$onie_grub_cfg
|
|
grep = $onie_grub_cfg | sed -e 's/onie_//' -e 's/=.*$//' | while read var ; do
|
|
eval val='$'onie_$var
|
|
echo "onie_${var}=${val}" >> /host/machine.conf
|
|
done
|
|
fi
|
|
|
|
umount /mnt/onie-boot
|
|
fi
|
|
|
|
. /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 old configuration saved during installation
|
|
if [ -d /host/old_config ]; then
|
|
rm -f /host/old_config/sonic_version.yml
|
|
mv -f /host/old_config/* /etc/sonic/
|
|
elif [ -f /host/minigraph.xml ]; then
|
|
mv /host/minigraph.xml /etc/sonic/
|
|
# Combine information in minigraph and init_cfg.json to form initiate config DB dump file.
|
|
# TODO: After moving all information from minigraph to DB, sample config DB dump should be provide
|
|
if [ -f /etc/sonic/init_cfg.json ]; then
|
|
sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json
|
|
else
|
|
sonic-cfggen -m --print-data > /etc/sonic/config_db.json
|
|
fi
|
|
else
|
|
cp /usr/share/sonic/device/$platform/minigraph.xml /etc/sonic/
|
|
if [ -f /etc/sonic/init_cfg.json ]; then
|
|
sonic-cfggen -m -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json
|
|
else
|
|
sonic-cfggen -m --print-data > /etc/sonic/config_db.json
|
|
fi
|
|
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
|