summaryrefslogtreecommitdiff
path: root/docs/static/setup.ps1
diff options
context:
space:
mode:
authorPete Johanson <peter@peterjohanson.com>2020-10-10 20:09:55 -0400
committerGitHub <noreply@github.com>2020-10-10 20:09:55 -0400
commita7e8655287e93ce16c14c191dd8e6eca13fa48db (patch)
treebb10e3942efe7e972197afafb99f599da0de2ab4 /docs/static/setup.ps1
parentd38740cebf3be17a7d55fc51f5f06752182f96d8 (diff)
parent4aa45c6f40c3e640cebce58b4d10cd24dc61b8ed (diff)
Merge pull request #256 from careyk007/check_directory_write_permissions_in_setup_script
Exit setup if no write permissions in directory
Diffstat (limited to 'docs/static/setup.ps1')
-rw-r--r--docs/static/setup.ps115
1 files changed, 14 insertions, 1 deletions
diff --git a/docs/static/setup.ps1 b/docs/static/setup.ps1
index abdb698..63bd5c0 100644
--- a/docs/static/setup.ps1
+++ b/docs/static/setup.ps1
@@ -57,7 +57,20 @@ catch [System.Management.Automation.CommandNotFoundException] {
}
Test-Git-Config -Option "user.name" -ErrMsg "Git username not set!`nRun: git config --global user.name 'My Name'"
-Test-Git-Config -Option "user.email" -ErrMsg "Git email not set!`nRun: git config --global user.name 'example@myemail.com'"
+Test-Git-Config -Option "user.email" -ErrMsg "Git email not set!`nRun: git config --global user.email 'example@myemail.com'"
+
+$permission = (Get-Acl $pwd).Access |
+?{$_.IdentityReference -match $env:UserName `
+ -and $_.FileSystemRights -match "FullControl" `
+ -or $_.FileSystemRights -match "Write" } |
+
+ Select IdentityReference,FileSystemRights
+
+If (-Not $permission){
+ Write-Host "Sorry, you do not have write permissions in this directory."
+ Write-Host "Please try running this script again from a directory that you do have write permissions for."
+ exit 1
+}
$repo_path = "https://github.com/zmkfirmware/zmk-config-split-template.git"