Skip to content

Commit

Permalink
fix github action default HOME directory as /home/runner
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightXiaoHan committed Jan 19, 2024
1 parent c37350d commit 11db3f7
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ elif [ "$MODE" = "unpack" ]; then
echo "Usage: install.sh unpack <tarfile>"
exit 1
fi
OLD_INSTALL_DIR=${3:-/root/.homecli}
# Github action runner default home dir is /home/runner
OLD_INSTALL_DIR=${3:-/home/runner/.homecli}
mkdir -p $INSTALL_DIR
tar -xvf "$TARFILE" -C "$INSTALL_DIR"
mkdir -p $INSTALL_DIR/miniconda
Expand Down Expand Up @@ -54,7 +55,7 @@ fi

# link nvim dir if .config/nvim not exist
if [ ! -d ~/.config/nvim ]; then
rm $DIR/NvChad/lua/custom || true
rm $DIR/NvChad/lua/custom || true
ln -sf $DIR/custom/ $DIR/NvChad/lua/custom
ln -sf $DIR/NvChad/ ~/.config/nvim
else
Expand Down Expand Up @@ -123,28 +124,28 @@ elif [ "$MODE" = "unpack" ]; then
fi
done

for file in $(find $INSTALL_DIR -type l ! -exec test -e {} \; -print); do
for file in $(find $INSTALL_DIR -type l ! -exec test -e {} \; -print); do
old=$(readlink $file)
if [[ $old == $OLD_INSTALL_DIR* ]]; then
if [[ $old == $OLD_INSTALL_DIR* ]]; then
new=$(echo $old | sed "s|$OLD_INSTALL_DIR|$INSTALL_DIR|")
rm $file
ln -sf $new $file
fi
done

for file in $(find $INSTALL_DIR -name "pyvenv.cfg"); do
sed -i "s|$OLD_INSTALL_DIR|$INSTALL_DIR|g" $file
done
for file in $(find $INSTALL_DIR -name "pyvenv.cfg"); do
sed -i "s|$OLD_INSTALL_DIR|$INSTALL_DIR|g" $file
done

for file in $(find $HOME/.local/share/nvim -name "pyvenv.cfg"); do
sed -i "s|$OLD_INSTALL_DIR|$INSTALL_DIR|g" $file
sed -i "s|venv .*/.local/share/nvim|venv $HOME/.local/share/nvim|g" $file
done
for file in $(find $HOME/.local/share/nvim -name "pyvenv.cfg"); do
sed -i "s|$OLD_INSTALL_DIR|$INSTALL_DIR|g" $file
sed -i "s|venv .*/.local/share/nvim|venv $HOME/.local/share/nvim|g" $file
done

for file in $(find $HOME/.local/share/nvim/mason/bin -type l); do
origin_file=$(readlink $file)
sed -i "s|#!.*/.local/share/nvim/mason/packages|#!$HOME/.local/share/nvim/mason/packages|g" $origin_file
done
done
for file in $(find $HOME/.local/share/nvim/mason/bin -type l); do
origin_file=$(readlink $file)
sed -i "s|#!.*/.local/share/nvim/mason/packages|#!$HOME/.local/share/nvim/mason/packages|g" $origin_file
done

elif [ "$MODE" = "relink" ]; then
ln -sf $INSTALL_DIR/nvim/ ~/.local/share/nvim
Expand Down

0 comments on commit 11db3f7

Please sign in to comment.