Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added get_mvcmd.sh to not create files/directories as root when run a… #35

Open
wants to merge 1 commit into
base: ncsdk2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions api/src/get_mvcmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ ncsdk_pkg=${download_filename%%.tar.gz}
# create mvnc directory
mkdir -p ${mvcmd_dir}

# set owner to the person that called sudo
if [ "${SUDO_USER}" == "" ]
then
echo ""
else
chown ${SUDO_USER} ${mvcmd_dir}
chgrp ${SUDO_USER} ${mvcmd_dir}
fi


# search for FW in tarball
ARCH=$(uname -m)
tar -tf ${download_filename} | grep -q "ncsdk-${ARCH}/fw/$"
Expand All @@ -116,6 +126,16 @@ fi
ls mvnc/*.mvcmd >& /dev/null
if [ $? -eq 0 ]; then
echo "NCSDK FW successfully installed"

# set owner to the person that called sudo
if [ "${SUDO_USER}" == "" ]
then
echo ""
else
chown ${SUDO_USER} mvnc/*.mvcmd
chgrp ${SUDO_USER} mvnc/*.mvcmd
fi

# remove old FW dir if it exists
[ -d ${mvcmd_old_dir} ] && rm -rf ${mvcmd_old_dir}
else
Expand Down