Setup npm on mesh

This commit is contained in:
Bob Mottram 2018-04-12 20:19:03 +01:00
parent b13d431627
commit 70d768371d
1 changed files with 20 additions and 0 deletions

View File

@ -357,8 +357,27 @@ function scuttlebot_git_setup {
fi fi
} }
function mesh_setup_npm {
cat <<EOF > "$rootdir/usr/bin/install_npm_global"
#!/bin/bash
if [ ! -d ~/.npm-global ]; then
mkdir ~/.npm-global
fi
npm config set prefix '~/.npm-global'
if [[ "$PATH" != *'~/.npm-global/bin'* ]]; then
export PATH=~/.npm-global/bin:$PATH
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
fi
source ~/.profile
EOF
chroot "$rootdir" /bin/chmod +x /usr/bin/install_npm_global
chroot "$rootdir" /usr/bin/install_npm_global
rm "$rootdir/usr/bin/install_npm_global"
}
function mesh_install_dat { function mesh_install_dat {
get_npm_arch get_npm_arch
mesh_setup_npm
cat <<EOF > "$rootdir/usr/bin/install_dat" cat <<EOF > "$rootdir/usr/bin/install_dat"
#!/bin/bash #!/bin/bash
@ -379,6 +398,7 @@ function mesh_install_scuttlebot {
mesh_install_dat mesh_install_dat
get_npm_arch get_npm_arch
mesh_setup_npm
cat <<EOF > "$rootdir/usr/bin/install_scuttlebot" cat <<EOF > "$rootdir/usr/bin/install_scuttlebot"
#!/bin/bash #!/bin/bash