#!/bin/sh 

main_function ()
{

/usr/bin/unicorn_helper --register || true

chmod 777 /data

# Update script for users from 1.4.77
# if [[ $RAINBOW_OLD_VERSION == "1.4.77" ]]; then 
#   # if databag folder is passed from old container to new container 
#   # via new pre-update script

#   if [ -d "/shares/.sync/databag" ]; then
#     # call python script to create migration share using API
#     python /opt/migrate_1.4.77.py

#     cp -r /shares/.sync/databag/* /shares/Sync_Migrate_1-4-77
#     chown -R rainbow:users /shares/Sync_Migrate_1-4-77/*
#     chmod 775 /shares/Sync_Migrate_1-4-77/*
    
#     #perhaps should made to not delete the databag if it can be detected that the copy failed
#     rm -rf /shares/.sync/databag
#   fi
#   # Move application .sync to appropriate data locations
#   mv /shares/.sync /data/.sync
#   chmod 775 /data/.sync
#   chown -R rainbow:users /data/.sync

#   # Change permissions to 775 and ownership to rainbow:users
#   # But Exclude first level of depth folders because these should be owned by root
#   find /shares -user root -mindepth 2 -exec chown -R rainbow:users {} \; -exec chmod 775 {} \;
# fi

}

main_function

exit 0
