commit 4d61ea0

hovercats  ·  2026-02-10 20:53:18 +0000 UTC
parent bbd07c2
Skip using config file, as its not really needed when rcpm only relies on a handfull of variables.
instead do a proper check for these internally
3 files changed,  +11, -20
M rcpm
+1, -3
 1@@ -2,10 +2,8 @@ PREFIX=/usr/local
 2 
 3 install:
 4 	mkdir -p ${DESTDIR}${PREFIX}/bin
 5-	mkdir -p ${DESTDIR}/etc
 6-	chmod 755 rcpm rcpm.conf
 7+	chmod 755 rcpm
 8 	cp -f rcsm ${DESTDIR}${PREFIX}/bin
 9-	cp -f rcsm.conf ${DESTDIR}/etc
10 
11 uninstall:
12 	rm -rf ${DESTDIR}${PREFIX}/bin/rcsm
M rcpm
+10, -6
 1@@ -2,10 +2,6 @@
 2 
 3 flag e +
 4 
 5-# Assume we run locally if no global config is present
 6-if (test ! -f /etc/rcpm.conf) . ./rcpm.conf
 7-if not . /etc/rcpm.conf
 8-
 9 fn log {
10 	printf '%s\n' $"*
11 }
12@@ -15,8 +11,16 @@ fn errexit {
13 	exit 1
14 }
15 
16-if (~ $#RCPM_PATH 0) {
17-	errexit 'RCPM_PATH is not set'
18+# Check and set needed variables
19+if (~ $#RCPM_PATH 0) errexit RCPM_PATH needs to be set
20+if (~ $#RCPM_ROOT 0) RCPM_ROOT=/
21+if (~ $#RCPM_DB 0) RCPM_DB=/var/db/rcpm
22+if (~ $#RCPM_CACHE 0) {
23+	if (~ `{id -u} 0) RCPM_CACHE=/root/var/rcpm/bin
24+	if not {
25+		user=`{whoami}
26+		RCPM_CACHE=/home/$user/var/rcpm/bin
27+	}
28 }
29 
30 fn rcpm_help {
+0, -11
 1@@ -1,11 +0,0 @@
 2-#!/bin/rc
 3-
 4-flag e +
 5-
 6-RCPM_PATH=$PWD/repo
 7-RCPM_CACHE=$HOME/var/rcpm/bin
 8-RCPM_ROOT=/tmp/fs
 9-RCPM_DB=/var/db/rcpm
10-
11-# Otherwise rcpm exists prematurly
12-status=()