Skip to content

Commit 8050f37

Browse files
committed
revert not to automate alias generation
1 parent 52ea967 commit 8050f37

File tree

3 files changed

+9
-94
lines changed

3 files changed

+9
-94
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test.sh

gz_install.sh

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -299,52 +299,6 @@ if [ -f "$HOME/$ROS_INSTALL_ROOT/activate_ros" ]; then
299299
fi
300300
mv setenv_gz.sh "$HOME/$ROS_INSTALL_ROOT/activate_ros"
301301

302-
# Check if 'ros' alias is set and verify its correctness
303-
if alias ros &> /dev/null; then
304-
# Get the current alias value
305-
CURRENT_ALIAS=$(alias ros | sed -E "s/alias ros='(.*)'/\1/")
306-
EXPECTED_ALIAS="source $HOME/$ROS_INSTALL_ROOT/activate_ros"
307-
308-
if [ "$CURRENT_ALIAS" == "$EXPECTED_ALIAS" ]; then
309-
echo -e "\033[32m✅ 'ros' alias is already set correctly.\033[0m"
310-
else
311-
echo -e "\033[33m⚠️ 'ros' alias is set but points to a different location. Updating it...\033[0m"
312-
# Determine the shell configuration file
313-
if [ -n "$ZSH_VERSION" ]; then
314-
SHELL_RC="$HOME/.zshrc"
315-
elif [ -n "$BASH_VERSION" ]; then
316-
SHELL_RC="$HOME/.bashrc"
317-
elif [ -f "$HOME/.zprofile" ]; then
318-
SHELL_RC="$HOME/.zprofile"
319-
else
320-
echo -e "\033[31m❌ Error: Unsupported shell. Please manually update the alias in your shell configuration file.\033[0m"
321-
exit 1
322-
fi
323-
324-
# Update the alias in the shell configuration file
325-
sed -i '' "/alias ros=/d" "$SHELL_RC"
326-
echo "alias ros='source $HOME/$ROS_INSTALL_ROOT/activate_ros'" >> "$SHELL_RC"
327-
echo -e "\033[32m✅ 'ros' alias updated in $SHELL_RC. Please restart your terminal or run 'source $SHELL_RC' to apply changes.\033[0m"
328-
fi
329-
else
330-
echo -e "\033[33m⚠️ 'ros' alias is not set. Adding it...\033[0m"
331-
# Determine the shell configuration file
332-
if [ -n "$ZSH_VERSION" ]; then
333-
SHELL_RC="$HOME/.zshrc"
334-
elif [ -n "$BASH_VERSION" ]; then
335-
SHELL_RC="$HOME/.bashrc"
336-
elif [ -f "$HOME/.zprofile" ]; then
337-
SHELL_RC="$HOME/.zprofile"
338-
else
339-
echo -e "\033[31m❌ Error: Unsupported shell. Please manually add the alias to your shell configuration file.\033[0m"
340-
exit 1
341-
fi
342-
343-
# Add the alias to the shell configuration file
344-
echo "alias ros='source $HOME/$ROS_INSTALL_ROOT/activate_ros'" >> "$SHELL_RC"
345-
echo -e "\033[32m✅ 'ros' alias added to $SHELL_RC. Please restart your terminal or run 'source $SHELL_RC' to apply changes.\033[0m"
346-
fi
347-
348302
# Print post messages
349303
printf '\033[32m%.0s=\033[0m' {1..75} && echo
350304
echo -e "\033[32m🎉 Done. Hurray! 🍎 (Apple Silicon) + 🤖 = 🚀❤️🤩🎉🥳 \033[0m"
@@ -358,7 +312,10 @@ echo -e "\033[31m(IMPORTANT, both terminals should have \033[0m'source $HOME/$VI
358312
echo -e " [1st Terminal with ($VIRTUAL_ENV_ROOT)]\033[32m gz sim shapes.sdf -s \033[0m"
359313
echo -e " [2nd Terminal with ($VIRTUAL_ENV_ROOT)]\033[32m gz sim -g \033[0m"
360314
printf '\033[32m%.0s=\033[0m' {1..75} && echo
361-
echo -e "You can start ROS2 Jazzy - Gazebo Harmonic framework by typing '\033[34mros\033[0m' in the terminal (new terminal)."
315+
echo "To make alias for fast start, run the following command to add to ~/.zprofile:"
316+
echo -e "\033[34mecho 'alias ros=\"source $HOME/$ROS_INSTALL_ROOT/activate_ros\"' >> ~/.zprofile && source ~/.zprofile\033[0m"
317+
echo
318+
echo -e "Then, you can start ROS2 Jazzy by typing '\033[34mros\033[0m' in the terminal (new terminal)."
362319
echo -e "You may change the alias name to your preference in above alias command."
363320
echo
364321
echo "To deactivate this workspace, run:"

install.sh

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -558,52 +558,6 @@ if [ -f activate_ros ]; then
558558
fi
559559
mv setenv.sh activate_ros
560560

561-
# Check if 'ros' alias is set and verify its correctness
562-
if alias ros &> /dev/null; then
563-
# Get the current alias value
564-
CURRENT_ALIAS=$(alias ros | sed -E "s/alias ros='(.*)'/\1/")
565-
EXPECTED_ALIAS="source $HOME/$ROS_INSTALL_ROOT/activate_ros"
566-
567-
if [ "$CURRENT_ALIAS" == "$EXPECTED_ALIAS" ]; then
568-
echo -e "\033[32m✅ 'ros' alias is already set correctly.\033[0m"
569-
else
570-
echo -e "\033[33m⚠️ 'ros' alias is set but points to a different location. Updating it...\033[0m"
571-
# Determine the shell configuration file
572-
if [ -n "$ZSH_VERSION" ]; then
573-
SHELL_RC="$HOME/.zshrc"
574-
elif [ -n "$BASH_VERSION" ]; then
575-
SHELL_RC="$HOME/.bashrc"
576-
elif [ -f "$HOME/.zprofile" ]; then
577-
SHELL_RC="$HOME/.zprofile"
578-
else
579-
echo -e "\033[31m❌ Error: Unsupported shell. Please manually update the alias in your shell configuration file.\033[0m"
580-
exit 1
581-
fi
582-
583-
# Update the alias in the shell configuration file
584-
sed -i '' "/alias ros=/d" "$SHELL_RC"
585-
echo "alias ros='source $HOME/$ROS_INSTALL_ROOT/activate_ros'" >> "$SHELL_RC"
586-
echo -e "\033[32m✅ 'ros' alias updated in $SHELL_RC. Please restart your terminal or run 'source $SHELL_RC' to apply changes.\033[0m"
587-
fi
588-
else
589-
echo -e "\033[33m⚠️ 'ros' alias is not set. Adding it...\033[0m"
590-
# Determine the shell configuration file
591-
if [ -n "$ZSH_VERSION" ]; then
592-
SHELL_RC="$HOME/.zshrc"
593-
elif [ -n "$BASH_VERSION" ]; then
594-
SHELL_RC="$HOME/.bashrc"
595-
elif [ -f "$HOME/.zprofile" ]; then
596-
SHELL_RC="$HOME/.zprofile"
597-
else
598-
echo -e "\033[31m❌ Error: Unsupported shell. Please manually add the alias to your shell configuration file.\033[0m"
599-
exit 1
600-
fi
601-
602-
# Add the alias to the shell configuration file
603-
echo "alias ros='source $HOME/$ROS_INSTALL_ROOT/activate_ros'" >> "$SHELL_RC"
604-
echo -e "\033[32m✅ 'ros' alias added to $SHELL_RC. Please restart your terminal or run 'source $SHELL_RC' to apply changes.\033[0m"
605-
fi
606-
607561
# Print post messages
608562
printf '\033[32m%.0s=\033[0m' {1..75} && echo
609563
echo -e "\033[32m🎉 Done. Hurray! 🍎 (Apple Silicon) + 🤖 = 🚀❤️🤩🎉🥳 \033[0m"
@@ -612,7 +566,10 @@ echo "To activate the new ROS2 distribution run the following command:"
612566
echo -e "\033[32msource $HOME/$ROS_INSTALL_ROOT/activate_ros\033[0m"
613567
echo -e "\nThen, try '\033[32mros2\033[0m' or '\033[32mrviz2\033[0m' in the terminal to start ROS2 Jazzy."
614568
printf '\033[32m%.0s=\033[0m' {1..75} && echo
615-
echo -e "TYou can start ROS2 Jazzy by typing '\033[34mros\033[0m' in the terminal (new terminal)."
569+
echo "To make alias for fast start, run the following command to add to ~/.zprofile:"
570+
echo -e "\033[34mecho 'alias ros=\"source $HOME/$ROS_INSTALL_ROOT/activate_ros\"' >> ~/.zprofile && source ~/.zprofile\033[0m"
571+
echo
572+
echo -e "Then, you can start ROS2 Jazzy by typing '\033[34mros\033[0m' in the terminal (new terminal)."
616573
echo -e "You may change the alias name to your preference in above alias command."
617574
echo
618575
echo "To deactivate this workspace, run:"

0 commit comments

Comments
 (0)