From abe0fe49e7d22a24b3a2eb76c158cfd27d67393a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Sep 2025 07:58:50 +0000 Subject: [PATCH 1/2] Initial plan From 0eaeb46152b48cdca6a692e7df7fc579cce98c84 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Sep 2025 08:05:47 +0000 Subject: [PATCH 2/2] Fix DAppNode profile sourcing in all shell environments Co-authored-by: pablomendezroyo <41727368+pablomendezroyo@users.noreply.github.com> --- scripts/dappnode_install.sh | 21 +++++++++++++++------ scripts/dappnode_uninstall.sh | 14 ++++++++++---- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/scripts/dappnode_install.sh b/scripts/dappnode_install.sh index b25c7bf5..f285289a 100755 --- a/scripts/dappnode_install.sh +++ b/scripts/dappnode_install.sh @@ -266,12 +266,21 @@ dappnode_start() { # Show credentials to the user on login USER=$(grep 1000 /etc/passwd | cut -f 1 -d:) - [ -n "$USER" ] && PROFILE=/home/$USER/.profile || PROFILE=/root/.profile - - if ! grep -q "${DAPPNODE_PROFILE}" "$PROFILE"; then - echo "######## DAPPNODE PROFILE ########" >>$PROFILE - echo -e "source ${DAPPNODE_PROFILE}\n" >>$PROFILE - fi + [ -n "$USER" ] && USER_HOME=/home/$USER || USER_HOME=/root + + # Add profile sourcing to both .profile and .bashrc for maximum compatibility + for config_file in .profile .bashrc; do + CONFIG_PATH="$USER_HOME/$config_file" + + # Create config file if it doesn't exist + [ ! -f "$CONFIG_PATH" ] && touch "$CONFIG_PATH" + + # Add profile sourcing if not already present + if ! grep -q "${DAPPNODE_PROFILE}" "$CONFIG_PATH"; then + echo "######## DAPPNODE PROFILE ########" >>"$CONFIG_PATH" + echo -e "source ${DAPPNODE_PROFILE}\n" >>"$CONFIG_PATH" + fi + done # Remove return from profile sed -i '/return/d' $DAPPNODE_PROFILE | tee -a $LOGFILE diff --git a/scripts/dappnode_uninstall.sh b/scripts/dappnode_uninstall.sh index 9f9c68b7..66bc9f35 100755 --- a/scripts/dappnode_uninstall.sh +++ b/scripts/dappnode_uninstall.sh @@ -45,11 +45,17 @@ uninstall() { echo -e "\e[32mRemoving DAppNode directory\e[0m" rm -rf /usr/src/dappnode - # Remove profile file + # Remove profile file references from shell config files USER=$(grep 1000 /etc/passwd | cut -f 1 -d:) - [ -n "$USER" ] && PROFILE=/home/$USER/.profile || PROFILE=/root/.profile - sed -i '/######## DAPPNODE PROFILE ########/g' $PROFILE - sed -i '/.*dappnode_profile/g' $PROFILE + [ -n "$USER" ] && USER_HOME=/home/$USER || USER_HOME=/root + + for config_file in .profile .bashrc; do + CONFIG_PATH="$USER_HOME/$config_file" + if [ -f "$CONFIG_PATH" ]; then + sed -i '/######## DAPPNODE PROFILE ########/d' "$CONFIG_PATH" + sed -i '/.*dappnode_profile/d' "$CONFIG_PATH" + fi + done echo -e "\e[32mDAppNode uninstalled!\e[0m" }