Add install_scone.sh

This commit is contained in:
Olivier 'reivilibre' 2020-12-31 19:53:50 +00:00
parent 94e39b7249
commit a3a2a068ab

43
contrib/install_scone.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh -eu
# Usage: ./contrib/install_scone.py someuser@somehost
# NOTE: you need sudo privilege.
# try: # echo 'scone ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/scone
# # chmod 0440 /etc/sudoers.d/scone
# # visudo -c
# TODO need to open up rights to various dirs so that other users can access
pyvenv='~/.scone/venv'
remote=$1
version='0.1.0'
# create a source distribution
python3 setup.py sdist
if ! ssh -q "$remote" -- dpkg-query -W -f="'"'${Status}'"'" python3-venv | grep "ok installed"; then
ssh -qt "$remote" -- sudo apt-get install python3 python3-venv
else
echo "python3-venv already installed"
fi
if ! ssh -q "$remote" -- test -d "$pyvenv"; then
# create the dir
ssh -q "$remote" -- mkdir -p "$pyvenv"
# install Python
ssh -q "$remote" -- python3 -m venv "$pyvenv"
fi
# copy sdist
scp "./dist/scone-$version.tar.gz" "$remote:~/.scone/"
# install sdist
ssh -q "$remote" -- "$pyvenv/bin/pip" install "~/.scone/scone-$version.tar.gz[sous]" || :
# don't need any special treatment for now, blank toml will do
ssh -q "$remote" -- touch "~/.scone/scone.sous.toml"
# create the worktop dir
ssh -q "$remote" -- mkdir -p "~/.scone/worktop"
ssh -q "$remote" -- chmod ugo+rX "~" "~/.scone/" "~/.scone/worktop"
ssh -q "$remote" -- chmod -R ugo+rX "~/.scone/venv"
ssh -q "$remote" -- chmod ugo+w,+t "~/.scone/worktop"