Skip to content

Commit

Permalink
Adding check for write permissions to file system
Browse files Browse the repository at this point in the history
  • Loading branch information
tombujok committed Apr 1, 2015
1 parent 01d343c commit 154c7ea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions babun-core/plugins/core/src/babun
Expand Up @@ -110,6 +110,14 @@ function update()
{
if [ "$args" != "" ] && [ "$args" != "--force" ]; then echo "ERROR: Wrong argument $args"; exit 1; fi
echo "Executing babun update"

permcheck=$( chmod 755 /usr/ 2> /dev/null || echo "FAILED" )
if [[ $permcheck == "FAILED" ]]; then
echo -e "You don't have write permission to / filesystem. Aborting!"
echo -e "Hint: Have you installed babun as admin and run it from a non-admin account? Retry as admin."
exit 1
fi

cp "$core"/tools/update_source.sh /tmp/update_source.sh
/tmp/update_source.sh "$args"
exit 0
Expand Down
11 changes: 11 additions & 0 deletions babun-core/tools/check.sh
Expand Up @@ -71,6 +71,16 @@ function exec_check_prompt {
fi
}

function exec_check_permissions {
permcheck=$( chmod 755 /usr/ 2> /dev/null || echo "FAILED" )
if [[ $permcheck == "FAILED" ]]; then
echo -e "File permissions [FAILED]"
echo -e "Hint: Have you installed babun as admin and run it from a non-admin account?"
else
echo -e "File permissions [OK]"
fi
}

function exec_check_cygwin {
local newest_cygwin_version=$( get_newest_cygwin_version )
if [[ -z "$newest_cygwin_version" ]]; then
Expand All @@ -92,6 +102,7 @@ function exec_check_cygwin {

function babun_check {
exec_check_prompt
exec_check_permissions

local newest_version=$( get_newest_version )
if [[ -z "$newest_version" ]]; then
Expand Down

0 comments on commit 154c7ea

Please sign in to comment.