Closed Amerlander closed 3 years ago
The following is what I did on my Raspberry Pi running the publicly available Raspberry Pi OS. I started with cloning the git repository. But starting from the ZIP file containing all the files from the git repository should give the same result.
I created a temporary user calltest
only for testing the setup script.
pi@pimuckl:~/tmp $ git clone https://github.com/calliope-edu/CalliopEO_AstroPi.git
Cloning into 'CalliopEO_AstroPi'...
remote: Enumerating objects: 197, done.
remote: Counting objects: 100% (197/197), done.
remote: Compressing objects: 100% (129/129), done.
remote: Total 197 (delta 103), reused 143 (delta 65), pack-reused 0
Receiving objects: 100% (197/197), 787.85 KiB | 3.28 MiB/s, done.
Resolving deltas: 100% (103/103), done.
pi@pimuckl:~/tmp $ cd CalliopEO_AstroPi/
pi@pimuckl:~/tmp/CalliopEO_AstroPi $ sudo ./setup.sh calltest
-=# SETUP #=-
Creating user calltest.
Assign user calltest to group(s): dialout
Add/change password for calltest? [yN]y
New password:
Retype new password:
passwd: password updated successfully
Calliope detected.
UUID Mini: 0123-4567
UUID Flash: 089A-BCDE
Copying files to /home/calltest/
Creating local mount points in /home/calltest/mnt/
Adding mount point definitions to /etc/fstab
Installing Python modules
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing ./modules/argparse-1.4.0-py2.py3-none-any.whl
Installing collected packages: argparse
Successfully installed argparse-1.4.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing ./modules/blkinfo-0.1.2-py3-none-any.whl
Installing collected packages: blkinfo
Successfully installed blkinfo-0.1.2
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing ./modules/pyserial-3.5-py2.py3-none-any.whl
Installing collected packages: pyserial
The scripts pyserial-miniterm and pyserial-ports are installed in '/home/calltest/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pyserial-3.5
Finished!
pi@pimuckl:~/tmp/CalliopEO_AstroPi $ su calltest
Password:
calltest@pimuckl:/home/pi/tmp/CalliopEO_AstroPi $ cd
calltest@pimuckl:~ $ python3 CalliopEO.py --max-script-execution-time=60
-=# CalliopEO #=-
no archives found in this directory
make sure you have at least one archive in this directory
calltest@pimuckl:~ $
You see, in the end I could execute CalliopEO.py
from the home directory of the newly created user calltest
. The user rights are set properly. Of course, the script terminates, because there is no hex file archive provided. But this is expected behavior.
Of course, copying everything directly to the home directory is not a "beautiful" solution.
The only thing we really need in the "productive environment" is the CalliopEO.py
script itself. I could just adapt the responsible lines in setup.sh
to copy only this file:
# Copy all the files from the respository to the home directory of
# user ${usernanme}
echo "Copying files to /home/${username}/"
#cp -r . /home/${username}/.
cp CalliopEO.py /home/${username}/.
It works fine on the astro pi with the setup script as it is.
Of course the .sh files (setup.sh and testing.sh) are not executeable by default and need a chmod +x
.
Where do we place the python file?
I did it like this:
chown -R calliope /home/calliope/tmp/CalliopEO
. Should we define where to place the files and handle the file rights in the setup script?