forked from obel1x/fedora-OEMDRV
sync_client_software: fix permissions and parameter check
This commit is contained in:
@@ -73,6 +73,27 @@ else
|
|||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
# Repository must always be set to the right path (but maybe empty, which is fine)
|
||||||
|
if [ "${CLIENT_SOFTWARE_CUST_DST}" != "${SYSCONFIGPATH}/client_software_cust" ]; then
|
||||||
|
echo "Error in config: Required parameter CLIENT_SOFTWARE_CUST_DST is missing or set wrong."
|
||||||
|
echo "Please relog and if the problem reoccures, contact your system admins to correct the Values."
|
||||||
|
read -n 1 -s -r -p "Press any key to continue"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Before running sync or software installs, restore the rights to all filles.
|
||||||
|
# They must be owned by root, changeable by admingroup and readable by otherusers (we are root, so we can change!)
|
||||||
|
# user_run.sh must also be executable by users
|
||||||
|
chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH}
|
||||||
|
chmod ug+rwX,o=rX -R ${SYSCONFIGPATH}
|
||||||
|
|
||||||
|
#Make all install.sh executable
|
||||||
|
find ${SYSCONFIGPATH}/client_software} -type f -name install.sh -exec chmod ug+x,o-x {} \;
|
||||||
|
find ${SYSCONFIGPATH}/client_software} -type f -name user_run.sh -exec chmod ugo+x {} \;
|
||||||
|
find ${CLIENT_SOFTWARE_CUST_DST} -type f -name install.sh -exec chmod ug+x,o-x {} \;
|
||||||
|
find ${CLIENT_SOFTWARE_CUST_DST} -type f -name user_run.sh -exec chmod ugo+x {} \;
|
||||||
|
|
||||||
# At first, sync central configs if they are configured to be synced
|
# At first, sync central configs if they are configured to be synced
|
||||||
if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then
|
if [[ ! -z "${DISTCONFIGPATH_SRC}" ]]; then
|
||||||
echo "Synced config path was found, doing remote sync."
|
echo "Synced config path was found, doing remote sync."
|
||||||
@@ -135,9 +156,9 @@ echo "Running all software scripts in admin- context."
|
|||||||
echo "Running pre installed scripts first."
|
echo "Running pre installed scripts first."
|
||||||
for DIR in $(ls -d ${SYSCONFIGPATH}/client_software/*/ | sort); do
|
for DIR in $(ls -d ${SYSCONFIGPATH}/client_software/*/ | sort); do
|
||||||
DIR=${DIR%*/} # remove the trailing "/"
|
DIR=${DIR%*/} # remove the trailing "/"
|
||||||
if [[ "$1." != "." ]] && [[ "${DIR}" != *"$1"* ]]; then
|
if [[ "$2." != "." ]] && [[ "${DIR}" != *"$2"* ]]; then
|
||||||
#search for string in dir
|
#search for string in dir
|
||||||
echo "Skipping ${DIR} while not in search parameter ( $1 )."
|
echo "Skipping ${DIR} while not in search parameter ( $2 )."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if [ -f "${DIR}/install.sh" ]; then
|
if [ -f "${DIR}/install.sh" ]; then
|
||||||
@@ -158,19 +179,11 @@ done
|
|||||||
echo "Sucessfully installed pre-defined software."
|
echo "Sucessfully installed pre-defined software."
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Repository must be the right path (but maybe empty, which is fine)
|
# Then, sync all client_software-files
|
||||||
if [ "${CLIENT_SOFTWARE_CUST_DST}" != "${SYSCONFIGPATH}/client_software_cust" ]; then
|
if [[ -z "${CLIENT_SOFTWARE_CUST_SRC}" ]]; then
|
||||||
echo "Error in config: Required parameter CLIENT_SOFTWARE_CUST_DST is missing or set wrong."
|
|
||||||
echo "Please relog and if the problem reoccures, contact your system admins to correct the Values."
|
|
||||||
read -n 1 -s -r -p "Press any key to continue"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
# Then, sync all client_software-files
|
|
||||||
if [[ -z "${CLIENT_SOFTWARE_CUST_SRC}" ]]; then
|
|
||||||
echo "No customer software sync is defined, skipping sync"
|
echo "No customer software sync is defined, skipping sync"
|
||||||
echo "${CLIENT_SOFTWARE_CUST_DST} with ${CLIENT_SOFTWARE_CUST_SRC}"
|
echo "${CLIENT_SOFTWARE_CUST_DST} with ${CLIENT_SOFTWARE_CUST_SRC}"
|
||||||
else
|
else
|
||||||
echo "Syncing customer software repository ${CLIENT_SOFTWARE_CUST_DST}"
|
echo "Syncing customer software repository ${CLIENT_SOFTWARE_CUST_DST}"
|
||||||
# Create Directory if not existent
|
# Create Directory if not existent
|
||||||
mkdir -p ${CLIENT_SOFTWARE_CUST_DST}
|
mkdir -p ${CLIENT_SOFTWARE_CUST_DST}
|
||||||
@@ -190,19 +203,12 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Sucessfully synced."
|
echo "Sucessfully synced."
|
||||||
|
|
||||||
# After sync again, restore the rights to all filles. They must be owned by root, changeable by admingroup and readable by otherusers (we are root, so we can change!)
|
|
||||||
chown root:${CLIENTADMINGROUP} -R ${SYSCONFIGPATH}
|
|
||||||
chmod ug+rwX,o=rX -R ${SYSCONFIGPATH}
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
|
||||||
#Run customer setup
|
#Run customer setup
|
||||||
if [ ! -z "${CLIENT_SOFTWARE_CUST_DST}" ]; then
|
if [ ! -z "${CLIENT_SOFTWARE_CUST_DST}" ]; then
|
||||||
echo "Running all software scripts in admin- context."
|
echo "Running all software scripts in admin- context."
|
||||||
#Make all install.sh executable
|
|
||||||
find ${CLIENT_SOFTWARE_CUST_DST} -type f -name install.sh -exec chmod ugo+x {} \;
|
|
||||||
for DIR in $(ls -d ${CLIENT_SOFTWARE_CUST_DST}/*/ | sort); do
|
for DIR in $(ls -d ${CLIENT_SOFTWARE_CUST_DST}/*/ | sort); do
|
||||||
DIR=${DIR%*/} # remove the trailing "/"
|
DIR=${DIR%*/} # remove the trailing "/"
|
||||||
if [[ "$1." != "." ]] && [[ "${DIR}" != *"$1"* ]]; then
|
if [[ "$1." != "." ]] && [[ "${DIR}" != *"$1"* ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user