From 9c0bd16d1292de0e4e2770715bddbea28100328e Mon Sep 17 00:00:00 2001 From: Jali Date: Sat, 27 Sep 2025 22:00:47 +0200 Subject: [PATCH 1/4] Add usage information --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/README.md b/README.md index 58522e1..76b22a0 100644 --- a/README.md +++ b/README.md @@ -82,3 +82,60 @@ 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: + +```bash +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: +`|`. 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. + +```bash +#!/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 +``` From 7e5e769c8fd16dfbb2043ad39c1a2feba069f721 Mon Sep 17 00:00:00 2001 From: Jali Date: Thu, 23 Jul 2026 19:32:26 +0100 Subject: [PATCH 2/4] Fix line 59 --- services/git-monitor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/git-monitor b/services/git-monitor index 3d59819..98f222f 100755 --- a/services/git-monitor +++ b/services/git-monitor @@ -56,7 +56,7 @@ check_for_updates() { # Get the last known commit hash (from a file) cd "$GITMONITOR -_LOCAL_PATH/$repo_name" + $GITMONITOR_LOCAL_PATH/$repo_name" if [ -f "$GITMONITOR_LOCAL_PATH/$repo_name/.git-monitor-last-commit" ]; then last_commit_hash=$(cat "$GITMONITOR_LOCAL_PATH/$repo_name/.git-monitor-last-commit") else From 91e937f9e583be24baf4f4345782d00fe19848a6 Mon Sep 17 00:00:00 2001 From: Jali Date: Thu, 23 Jul 2026 19:37:06 +0100 Subject: [PATCH 3/4] Finally fix the problem --- services/git-monitor | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/git-monitor b/services/git-monitor index 98f222f..ed1d119 100755 --- a/services/git-monitor +++ b/services/git-monitor @@ -55,8 +55,7 @@ check_for_updates() { local current_commit_hash # Get the last known commit hash (from a file) - cd "$GITMONITOR - $GITMONITOR_LOCAL_PATH/$repo_name" + cd "$GITMONITOR_LOCAL_PATH/$repo_name" if [ -f "$GITMONITOR_LOCAL_PATH/$repo_name/.git-monitor-last-commit" ]; then last_commit_hash=$(cat "$GITMONITOR_LOCAL_PATH/$repo_name/.git-monitor-last-commit") else From 81920fa822e36f2bd1c5702f8a645f951533f694 Mon Sep 17 00:00:00 2001 From: Jali Date: Thu, 23 Jul 2026 19:44:52 +0100 Subject: [PATCH 4/4] Remove another line break --- services/git-monitor | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/git-monitor b/services/git-monitor index ed1d119..de3f2c0 100755 --- a/services/git-monitor +++ b/services/git-monitor @@ -68,8 +68,7 @@ check_for_updates() { if [ -z "$last_commit_hash" ] || [ "$current_commit_hash" != "$last_commit_hash" ]; then log_message "INFO" "New commits detected. Pulling..." - git -C "$GITMONITOR - _LOCAL_PATH/$repo_name" pull origin $GITMONITOR_BRANCH_NAME + git -C "$GITMONITOR_LOCAL_PATH/$repo_name" pull origin $GITMONITOR_BRANCH_NAME if [ $? -eq 0 ]; then log_message "INFO" "Pull successful."