#! /bin/sh

# Copyright (c) 2023 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.


create_symlinks()
{
cd $1
devices=$(ls)
for device in $devices;do

                        if [ "$(echo "$device" | grep "_b")" ]; then
                                length=${#device}
                                if [ ${length} -le 2 ]; then
                                        exit
                                fi
                                partition="${device%_b}"
                                if [ -e "$partition" ] && [ ! -e "$partition_a" ]; then
                                        ln -s "$partition" "${partition}_a"
                                fi
                        fi
done

}

create_symlinks "/dev/block/bootdevice/by-name/"
create_symlinks "/dev/disk/by-partlabel/"
