Add a script for installing scone-sous on non-Debian systems

This commit is contained in:
Olivier 'reivilibre' 2021-09-17 21:27:14 +01:00
parent 17c01b13fa
commit 5962d7863c

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"