diff --git a/scripts/install.sh b/scripts/install.sh index 5bc4b99..659eb19 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -16,7 +16,8 @@ elif [ "$MODE" = "unpack" ]; then echo "Usage: install.sh unpack " 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 @@ -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 @@ -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