forked from gwsystems/sledge-serverless-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_root.sh
More file actions
executable file
·21 lines (17 loc) · 719 Bytes
/
fix_root.sh
File metadata and controls
executable file
·21 lines (17 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# Currently, the build container still used root. This results in files owned by root that interfere with running things outside of the container. Pending additional tooling work, this script is a stop gap that searches and chowns all files in the proeject tree owned by root
if [[ $(whoami) == "root" ]]; then
echo "Should not be run as root"
exit 1
fi
if [[ $(pwd) == "/" ]]; then
echo "Should not be run from root directory"
exit 1
fi
# Uses your host username and its primary associated group
username="$(whoami)"
group="$(id -g -n "$username")"
while read -r file; do
echo sudo chown "$username":"$group" "$file"
sudo chown "$username":"$group" "$file"
done < <(find ~+ -type f,d -user root)