Files
PiDP10Services/README.md
2025-09-27 22:00:47 +02:00

4.6 KiB

PiDP 10 Services

Overview

This repository combines a set of useful scripts and services, to run on the PiDP-10 in order to make it easier to work with it and develop for it. These services can be installed on the PiDP-10 and automate tasks such as copying files onto the ITS operating system. These tools help automate processes, that would require interaction with the Linux part of the PiDP-10 when developing on another system.

git-monitor

The git-monitor is a system service that monitors a target directory on the PiDP-10. It contains a file with a list of git repositories to monitor, one at a time. The service will check if any of the repositories changed, and pull them. After a successful pull a script will be called, if it exists, that allows the newly updated repository to interact with a running PDP-10 simulation.

The monitor consists of a script, that needs to be installed to /usr/local/bin and a systemd unit-file to run it as a service.

Installation

To install the git-monitor, clone this repository to the target computer, and run the install script:

git clone https://gitea.orca-central.de/jali/PiDP10Services.git
sudo ./install.sh

This will install the service on your system and start it. If you want the service to be enabled on system boot, enable the service:

sudo systemctl enable git-monitor.service

Configuration

The service is usable immediately after installation. The service is configured through a series of environment variables, that can be set to change the default behaviour. There are five different environment variables to configure the service with:

Environment Variable Description Default Value
GITMONITOR_URLS A file that contains the list of observed repositories in a directory by name and URL. /opt/src/repository.list
GITMONITOR_LOCAL_PATH The path in which the clone repositories will be stored. /opt/src
GITMONITOR_BRANCH_NAME The name of the branch to observe. develop
GITMONITOR_POLL_INTERVALL The number of seconds to wait until the next poll. 30
GITMONITOR_LOCK_FILE The lock file that is used to monitor the service. /run/lock/git-monitor.lock

You can override these settings by creating an override file for the service unit. Create a new file /etc/serviced/service/git-monitor.service.d/override.conf by typing sudo systemctl edit git-monitor.service. You can then uncomment the Environment statements, and change the value of the variables accordingly.

After any changes to the configuration run:

sudo systemctl daemon-reload
sudo systemctl restart git-montitor.service

Using

In order to observe your repository, you need to configure the repository list, and add your repository to the watchlist. To do so, edit the $GITMONITOR_REPO_URLS-file (default: /opt/src/repository.list). Every entry in the repository is a line in this file. And every line contains the local name of a repository and the URL to clone from in the form: <myrepository>|<external URL>. For example, a line could be:

PDP10Sudoku|htts://foo.bar/jali/PDP10Sudoku.git

Save the file. On the next poll the service performs, the repository will be watched. If the local repository doesn't exist yet, it is automatically cloned. Keep in mind that currently, the service only supports public repositories. This may change in the future if it is required.

Now you will always have the current code on the Raspberry Pi. But it is still on the PI side, and not inside the simulator. To allow this, the service will run a shell script every time a change is detected in the system. The file must reside in the root directory of your repository, and be named .git-monitor_after.sh. In order to copy source code from the Raspbery Pi side of a PiDP 10 you can use the mlftp tool, and copy exactly the files you'd like.

#!/bin/sh
# Copies the source files to the ITS system

MLFTP="/opt/pidp10/bin/mlftp"

SOURCEFILE="./src/myprogram.s"
TARGETFILE="MYPROG 1 JALI;"


# Functions
log_message() {
  local level=$1
  local message=$2
  timestamp=$(date +'%Y-%m-%d %H:%M:%S')
  #echo "$timestamp [$level] $message" >> "$LOG_FILE"
  echo "$timestamp [$level] $message"  # Also print to console (optional)
}

# Main execution
log_message "INFO" "Uploading $SOURCEFILE to $TARGETFILE on ITS"
$MLFTP -w its "$TARGETFILE" $SOURCEFILE