scripts/prepare-msm.sh: Use SUDO variable
Use the sudo variable and allow the script to run if we don't have sudo.
@@ -31,17 +31,26 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
setup_user=$USER
setup_group=$( id -gn $USER )
+function found_exe() {
+ hash "$1" 2>/dev/null
+}
+
+if found_exe sudo ; then
+ # The main checks happen in dev_setup.sh, don't error here if we don't have sudo
+ SUDO=sudo
+fi
+
# change ownership of ${mycroft_root_dir} to ${setup_user } recursively
function change_ownership {
echo "Changing ownership of" ${mycroft_root_dir} "to user:" ${setup_user} "with group:" ${setup_group}
- sudo chown -Rvf ${setup_user}:${setup_group} ${mycroft_root_dir}
+ $SUDO chown -Rvf ${setup_user}:${setup_group} ${mycroft_root_dir}
}
if [[ ${IS_TRAVIS} != true ]] ; then
if [ ! -d ${skills_dir} ] ; then
echo "Create ${skills_dir}"
- sudo mkdir -p ${skills_dir}
+ $SUDO mkdir -p ${skills_dir}
change_ownership
fi
