scone/contrib/install_scone.sh

44 lines
1.3 KiB
Bash
Executable File

#!/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.2.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 -yq python3 python3-venv build-essential
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"