-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
69 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# Get the current user's ID, group ID, and username | ||
user_id=$(id -u) | ||
group_id=$(id -g) | ||
user_name=$(whoami) | ||
|
||
# Define source and destination file paths | ||
source_file=".devcontainer/devcontainer_base.json" | ||
destination_file=".devcontainer/devcontainer.json" | ||
|
||
# Check if the source file exists | ||
if [[ ! -f $source_file ]]; then | ||
echo "Source file $source_file does not exist. Exiting." | ||
exit 1 | ||
fi | ||
|
||
# Create the destination file with the updated content | ||
sed -e "s/\"USER_UID\": \"1000\"/\"USER_UID\": \"$user_id\"/g" \ | ||
-e "s/\"USER_GID\": \"1000\"/\"USER_GID\": \"$group_id\"/g" \ | ||
-e "s/\"remoteUser\": \"ubuntu\"/\"remoteUser\": \"$user_name\"/g" \ | ||
-e "s/\"USERNAME\": \"ubuntu\"/\"USERNAME\": \"$user_name\"/g" \ | ||
-e "s/USER=ubuntu/USER=$user_name/g" \ | ||
"$source_file" > "$destination_file" | ||
|
||
# Verify the operation and provide feedback | ||
if [[ $? -eq 0 ]]; then | ||
echo "File successfully created at $destination_file with updated user information:" | ||
echo " USER_UID: $user_id" | ||
echo " USER_GID: $group_id" | ||
echo " remoteUser: $user_name" | ||
else | ||
echo "Failed to create the file $destination_file." | ||
exit 2 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ MODULE.bazel.lock | |
resolved_deps.py | ||
*.swp | ||
compile_commands.json | ||
.devcontainer/devcontainer.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#!/bin/bash | ||
set -e | ||
export MOUNTED_DIR=$(pwd) | ||
echo "export MOUNTED_DIR=$MOUNTED_DIR" >> /home/vscode/.bashrc | ||
echo "export MOUNTED_DIR=$MOUNTED_DIR" >> /home/$USER/.bashrc | ||
if [ "$ENABLE_COMP_DB_REFRESH" = "true" ]; then | ||
echo "$(pwd)/ci/refresh_comp_db.sh &> /dev/null &" >> /home/vscode/.bashrc | ||
echo "$(pwd)/ci/refresh_comp_db.sh &> /dev/null &" >> /home/$USER/.bashrc | ||
fi | ||
bazel build //... | ||
bazel run @hedron_compile_commands//:refresh_all |