Last active
November 3, 2017 02:37
-
-
Save danieljsummers/4626790842e48725ecc5c18fc6a71692 to your computer and use it in GitHub Desktop.
A script to install hexo-cli globally on Linux without changing filesystem permissions (workaround for issue 2698)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INSTALL_DIR=/usr/lib/node_modules | |
SUB_DIR=$INSTALL_DIR/hexo-cli/node_modules | |
echo Getting root privileges... | |
sudo echo Done. | |
echo Installing in a temp directory... | |
mkdir tmp | |
cd tmp | |
npm install hexo-cli | |
echo "Done; moving to global NPM directory..." | |
cd node_modules | |
sudo chown -R root:root * | |
sudo mv hexo-cli $INSTALL_DIR | |
sudo mkdir $SUB_DIR | |
sudo mv * $SUB_DIR | |
echo "Done; cleaning up..." | |
cd ../.. | |
rm -r tmp | |
if [-f /usr/bin/hexo]; then | |
sudo rm /usr/bin/hexo | |
fi | |
sudo ln -s /usr/lib/node_modules/hexo-cli/bin/hexo /usr/bin/hexo | |
hexo | |
echo "" | |
echo If you see the Hexo help above, it has installed successfully |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment