forked from ItoMasaki/ROS2Docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathINCL-USER-ENV.bash
More file actions
executable file
·50 lines (41 loc) · 1.86 KB
/
INCL-USER-ENV.bash
File metadata and controls
executable file
·50 lines (41 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
################################################################################
# Install the SSH deploy key of the GitLab repository.
mkdir -p ~/.ssh/
chmod 700 ~/.ssh/
cp ./.ssh/ros2docker_id_rsa ~/.ssh/
chmod 600 ~/.ssh/ros2docker_id_rsa
if [ ! -f ~/.ssh/config ]; then
touch ~/.ssh/config
fi
if grep -E -q '^Host github\.com' ~/.ssh/config; then
echo "SSH configuration for 'github.com' is already included in '~/.ssh/config'."
echo "Manually add 'IdentityFile ~/.ssh/ros2docker_id_rsa' under 'github.com' if the connection is refused."
else
echo "Add new SSH configuration for 'github.com' in '~/.ssh/config'.";
cat <<'EOF' >> ~/.ssh/config;
Host github.com
Hostname github.com
IdentityFile ~/.ssh/ros2docker_id_rsa
StrictHostKeyChecking no
User git
EOF
fi
################################################################################
# Modify the HTTPS URL of the Git remote origin to use SSH:
# Enable authentication by using '~/.ssh/hsr-id_rsa' instead of a GitLab account.
# GIT_HTTPS_URL=`git config --get remote.origin.url`
# GIT_SSH_URL=`echo ${GIT_HTTPS_URL} | sed -e 's/^https\{0,1\}:/ssh:/'`
# if [ "${GIT_HTTPS_URL}" != "${GIT_SSH_URL}" ]; then
# echo "Update the Git remote origin from '${GIT_HTTPS_URL}' to '${GIT_SSH_URL}'."
# echo "Execute 'git config --get remote.origin.url' to manually confirm if needed."
# git remote set-url origin ${GIT_SSH_URL}
# fi
################################################################################
# Download and initialize all the Git submodules recursively.
# https://git-scm.com/book/en/v2/Git-Tools-Submodules
git submodule update --init --recursive
################################################################################
# Setup the Bash shell environment with '~/.bashrc'.
# Force color prompt in terminal.
sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/' ~/.bashrc