tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
rset: 2.1 -> 3.2
emaryn
11 months ago
3e393569
62b32a63
+87
-84
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
rs
rset
package.nix
paths.patch
+18
-21
pkgs/by-name/rs/rset/package.nix
···
1
1
{
2
2
lib,
3
3
stdenv,
4
4
-
fetchurl,
4
4
+
fetchFromGitHub,
5
5
coreutils,
6
6
openssh,
7
7
gnutar,
···
9
9
10
10
stdenv.mkDerivation rec {
11
11
pname = "rset";
12
12
-
version = "2.1";
12
12
+
version = "3.2";
13
13
14
14
-
src = fetchurl {
15
15
-
url = "https://scriptedconfiguration.org/code/${pname}-${version}.tar.gz";
16
16
-
sha256 = "0916f96afl8kcn2hpj4qhg92g2j93ycp2sb94nsz3q44sqc6ddhb";
14
14
+
src = fetchFromGitHub {
15
15
+
owner = "eradman";
16
16
+
repo = "rset";
17
17
+
tag = version;
18
18
+
hash = "sha256-b797R79aMopiPApTJ4Q3SP2MRjqCcNNO9BIxtuiNZks=";
17
19
};
18
20
19
21
patches = [ ./paths.patch ];
20
22
21
23
postPatch = ''
22
24
substituteInPlace rset.c \
23
23
-
--replace @ssh@ ${openssh}/bin/ssh \
24
24
-
--replace @miniquark@ $out/bin/miniquark \
25
25
-
--replace @rinstall@ $out/bin/rinstall \
26
26
-
--replace @rsub@ $out/bin/rsub
25
25
+
--replace-fail @ssh@ ${openssh}/bin/ssh \
26
26
+
--replace-fail @miniquark@ $out/bin/miniquark \
27
27
+
--replace-fail @rinstall@ $out/bin/rinstall \
28
28
+
--replace-fail @rsub@ $out/bin/rsub
27
29
28
30
substituteInPlace execute.c \
29
29
-
--replace @ssh@ ${openssh}/bin/ssh \
30
30
-
--replace @ssh-add@ ${openssh}/bin/ssh-add \
31
31
-
--replace @tar@ ${gnutar}/bin/tar
31
31
+
--replace-fail @ssh@ ${openssh}/bin/ssh \
32
32
+
--replace-fail @ssh-add@ ${openssh}/bin/ssh-add \
33
33
+
--replace-fail @tar@ ${gnutar}/bin/tar
32
34
33
35
substituteInPlace rutils.c \
34
34
-
--replace @install@ ${coreutils}/bin/install
36
36
+
--replace-fail @install@ ${coreutils}/bin/install
35
37
'';
36
38
37
39
# these are to be run on the remote host,
···
44
46
dontAddPrefix = true;
45
47
installFlags = [ "PREFIX=$(out)" ];
46
48
47
47
-
meta = with lib; {
49
49
+
meta = {
48
50
homepage = "https://scriptedconfiguration.org/";
49
51
description = "Configure systems using any scripting language";
50
52
changelog = "https://github.com/eradman/rset/raw/${version}/NEWS";
51
51
-
license = licenses.isc;
52
52
-
platforms = platforms.unix;
53
53
+
license = lib.licenses.isc;
54
54
+
platforms = lib.platforms.unix;
53
55
maintainers = [ ];
54
54
-
# 2023-08-19, fails to compile with glibc-2.38 because of strlcpy.
55
55
-
# At the time of writing, this was 4 minors behind already and
56
56
-
# the `paths.patch` didn't apply anymore, so this is now considered
57
57
-
# broken until somebody cares enough to fix and upgrade this.
58
58
-
broken = true;
59
56
};
60
57
}
+69
-63
pkgs/by-name/rs/rset/paths.patch
···
2
2
index be06068..3468fa7 100644
3
3
--- a/execute.c
4
4
+++ b/execute.c
5
5
-
@@ -242,7 +242,7 @@ verify_ssh_agent() {
5
5
+
@@ -260,7 +260,7 @@
6
6
char *output;
7
7
char *argv[32];
8
8
-
8
8
+
9
9
- append(argv, 0, "ssh-add", "-l", NULL);
10
10
+ append(argv, 0, "@ssh-add@", "-l", NULL);
11
11
output = cmd_pipe_stdout(argv, &error_code, &output_size);
12
12
free(output);
13
13
-
14
14
-
@@ -282,7 +282,7 @@ start_connection(char *socket_path, Label *route_label, int http_port, const cha
13
13
+
14
14
+
@@ -300,7 +300,7 @@
15
15
}
16
16
-
16
16
+
17
17
argc = 0;
18
18
-
- argc = append(argv, argc, "ssh", "-fN", "-R", port_forwarding, "-S",
19
19
-
+ argc = append(argv, argc, "@ssh@", "-fN", "-R", port_forwarding, "-S",
20
20
-
socket_path, "-M", NULL);
18
18
+
- argc = append(argv, argc, "ssh", "-fN", "-R", port_forwarding, "-S", socket_path, "-M", NULL);
19
19
+
+ argc = append(argv, argc, "@ssh@", "-fN", "-R", port_forwarding, "-S", socket_path, "-M", NULL);
21
20
if (ssh_config)
22
21
(void) append(argv, argc, "-F", ssh_config, host_name, NULL);
23
23
-
@@ -292,12 +292,12 @@ start_connection(char *socket_path, Label *route_label, int http_port, const cha
24
24
-
return -1;
25
25
-
26
26
-
snprintf(tmp_path, sizeof(tmp_path), "mkdir " REMOTE_TMP_PATH, http_port);
27
27
-
- append(argv, 0, "ssh", "-S", socket_path, host_name, tmp_path, NULL);
28
28
-
+ append(argv, 0, "@ssh@", "-S", socket_path, host_name, tmp_path, NULL);
29
29
-
if (run(argv) != 0)
30
30
-
return -1;
31
31
-
32
32
-
- snprintf(cmd, PATH_MAX, "tar -cf - %s -C " REPLICATED_DIRECTORY " ./ | "
33
33
-
- "exec ssh -q -S %s %s tar -xf - -C " REMOTE_TMP_PATH,
34
34
-
+ snprintf(cmd, PATH_MAX, "@tar@ -cf - %s -C " REPLICATED_DIRECTORY " ./ | "
35
35
-
+ "exec @ssh@ -q -S %s %s tar -xf - -C " REMOTE_TMP_PATH,
36
36
-
array_to_str(route_label->export_paths), socket_path, host_name,
37
37
-
http_port);
38
38
-
if (system(cmd) != 0) {
39
39
-
@@ -326,7 +326,7 @@ ssh_command_pipe(char *host_name, char *socket_path, Label *host_label, int http
40
40
-
22
22
+
else
23
23
+
@@ -309,8 +309,8 @@
24
24
+
return ret;
25
25
+
26
26
+
snprintf(cmd, PATH_MAX,
27
27
+
- "tar " TAR_OPTIONS " -cf - -C " REPLICATED_DIRECTORY " . "
28
28
+
- "| ssh -q -S %s %s 'mkdir %s; tar -xf - -C %s'",
29
29
+
+ "@tar@ " TAR_OPTIONS " -cf - -C " REPLICATED_DIRECTORY " . "
30
30
+
+ "| @ssh@ -q -S %s %s 'mkdir %s; tar -xf - -C %s'",
31
31
+
socket_path, host_name, stagedir(http_port), stagedir(http_port));
32
32
+
if ((ret = system(cmd)) != 0)
33
33
+
return ret;
34
34
+
@@ -320,8 +320,8 @@
35
35
+
array_to_str(route_label->export_paths, path_repr, sizeof(path_repr), " ");
36
36
+
37
37
+
snprintf(cmd, PATH_MAX,
38
38
+
- "tar " TAR_OPTIONS " -cf - %s "
39
39
+
- "| ssh -q -S %s %s 'tar -xf - -C %s'",
40
40
+
+ "@tar@ " TAR_OPTIONS " -cf - %s "
41
41
+
+ "| @ssh@ -q -S %s %s 'tar -xf - -C %s'",
42
42
+
path_repr, socket_path, host_name, stagedir(http_port));
43
43
+
44
44
+
if ((ret = system(cmd)) != 0)
45
45
+
@@ -407,7 +407,7 @@
46
46
+
41
47
/* construct ssh command */
42
48
argc = 0;
43
49
- argc = append(argv, argc, "ssh", "-T", "-S", socket_path, NULL);
44
50
+ argc = append(argv, argc, "@ssh@", "-T", "-S", socket_path, NULL);
45
45
-
51
51
+
46
52
(void) append(argv, argc, host_name, cmd, NULL);
47
47
-
return cmd_pipe_stdin(argv, host_label->content, host_label->content_size);
48
48
-
@@ -344,7 +344,7 @@ ssh_command_tty(char *host_name, char *socket_path, Label *host_label, int http_
49
49
-
http_port);
53
53
+
ret = cmd_pipe_stdin(argv, host_label->content, host_label->content_size);
54
54
+
@@ -432,7 +432,7 @@
55
55
+
snprintf(cmd, sizeof(cmd), "cat > %s/_script", stagedir(http_port));
50
56
/* construct ssh command */
51
57
argc = 0;
52
58
- argc = append(argv, argc, "ssh", "-T", "-S", socket_path, NULL);
53
59
+ argc = append(argv, argc, "@ssh@", "-T", "-S", socket_path, NULL);
54
60
(void) append(argv, argc, host_name, cmd, NULL);
55
61
cmd_pipe_stdin(argv, host_label->content, host_label->content_size);
56
56
-
57
57
-
@@ -360,7 +360,7 @@ ssh_command_tty(char *host_name, char *socket_path, Label *host_label, int http_
58
58
-
62
62
+
63
63
+
@@ -450,7 +450,7 @@
64
64
+
59
65
/* construct ssh command */
60
66
argc = 0;
61
67
- argc = append(argv, argc, "ssh", "-t", "-S", socket_path, NULL);
62
68
+ argc = append(argv, argc, "@ssh@", "-t", "-S", socket_path, NULL);
63
63
-
69
69
+
64
70
(void) append(argv, argc, host_name, cmd, NULL);
65
65
-
return run(argv);
66
66
-
@@ -375,11 +375,11 @@ end_connection(char *socket_path, char *host_name, int http_port) {
71
71
+
ret = run(argv);
72
72
+
@@ -498,11 +498,11 @@
73
73
+
if (access(socket_path, F_OK) == -1)
67
74
return;
68
68
-
69
69
-
snprintf(tmp_path, sizeof(tmp_path), REMOTE_TMP_PATH, http_port);
70
70
-
- append(argv, 0, "ssh", "-S", socket_path, host_name, "rm", "-rf", tmp_path , NULL);
71
71
-
+ append(argv, 0, "@ssh@", "-S", socket_path, host_name, "rm", "-rf", tmp_path , NULL);
75
75
+
76
76
+
- append(argv, 0, "ssh", "-S", socket_path, host_name, "rm", "-rf", stagedir(http_port), NULL);
77
77
+
+ append(argv, 0, "@ssh@", "-S", socket_path, host_name, "rm", "-rf", stagedir(http_port), NULL);
72
78
if (run(argv) != 0)
73
79
warn("remote tmp dir");
74
74
-
80
80
+
75
81
- append(argv, 0, "ssh", "-q", "-S", socket_path, "-O", "exit", host_name, NULL);
76
82
+ append(argv, 0, "@ssh@", "-q", "-S", socket_path, "-O", "exit", host_name, NULL);
77
83
if (run(argv) != 0)
···
81
87
index 383fc82..9c20f65 100644
82
88
--- a/rset.c
83
89
+++ b/rset.c
84
84
-
@@ -128,10 +128,8 @@ int main(int argc, char *argv[])
85
85
-
hostnames[i] = argv[optind+i];
86
86
-
hostnames[i] = NULL;
87
87
-
90
90
+
@@ -104,10 +104,8 @@
91
91
+
92
92
+
if ((renv_bin = findprog("renv")) == 0)
93
93
+
not_found("renv");
88
94
- if ((rinstall_bin = findprog("rinstall")) == 0)
89
95
- not_found("rinstall");
90
96
- if ((rsub_bin = findprog("rsub")) == 0)
91
97
- not_found("rsub");
92
92
-
+ rinstall_bin = "@rinstall@";
93
93
-
+ rsub_bin = "@rsub@";
94
94
-
98
98
+
+ rinstall_bin = "@rinstall@";
99
99
+
+ rsub_bin = "@rsub@";
100
100
+
95
101
/* all operations must be relative to the routes file */
96
102
if (realpath(xdirname(routes_file), routes_realpath) == NULL)
97
97
-
@@ -159,10 +157,9 @@ int main(int argc, char *argv[])
98
98
-
103
103
+
@@ -404,7 +402,7 @@
104
104
+
if (socket_path && hostname && http_port) {
105
105
+
printf("caught signal %d, terminating connection to '%s'\n", sig, hostname);
106
106
+
/* clean up socket and SSH connection; leaving staging dir */
107
107
+
- execlp("ssh", "ssh", "-S", socket_path, "-O", "exit", hostname, NULL);
108
108
+
+ execlp("@ssh@", "@ssh@", "-S", socket_path, "-O", "exit", hostname, NULL);
109
109
+
err(1, "ssh -O exit");
110
110
+
}
111
111
+
}
112
112
+
@@ -533,10 +531,9 @@
113
113
+
99
114
/* Convert http server command line into a vector */
100
115
inputstring = malloc(PATH_MAX);
101
116
- snprintf(inputstring, PATH_MAX, "miniquark -p %d -d " PUBLIC_DIRECTORY, http_port);
102
117
+ snprintf(inputstring, PATH_MAX, "@miniquark@ -p %d -d " PUBLIC_DIRECTORY, http_port);
103
103
-
str_to_array(http_srv_argv, inputstring, sizeof(http_srv_argv));
118
118
+
str_to_array(http_srv_argv, inputstring, sizeof(http_srv_argv), " ");
104
119
- if ((httpd_bin = findprog(http_srv_argv[0])) == 0)
105
120
- not_found(http_srv_argv[0]);
106
121
+ httpd_bin = "@miniquark@";
107
107
-
122
122
+
108
123
/* start the web server */
109
124
pipe(stdout_pipe);
110
110
-
@@ -397,7 +394,7 @@ handle_exit(int sig) {
111
111
-
printf("caught signal %d, terminating connection to '%s'\n", sig,
112
112
-
hostname);
113
113
-
/* clean up socket and SSH connection; leaving staging dir */
114
114
-
- execlp("ssh", "ssh", "-S", socket_path, "-O", "exit", hostname, NULL);
115
115
-
+ execlp("@ssh@", "@ssh@", "-S", socket_path, "-O", "exit", hostname, NULL);
116
116
-
err(1, "ssh -O exit");
117
117
-
}
118
118
-
}
119
125
diff --git a/rutils.c b/rutils.c
120
126
index 1e182d8..9aef76d 100644
121
127
--- a/rutils.c
122
128
+++ b/rutils.c
123
123
-
@@ -77,7 +77,7 @@ install_if_new(const char *src, const char *dst) {
124
124
-
129
129
+
@@ -123,7 +123,7 @@
130
130
+
125
131
pid = fork();
126
132
if (pid == 0) {
127
133
- if (execl("/usr/bin/install", "/usr/bin/install", src, dst, NULL) != -1)