summaryrefslogtreecommitdiff
path: root/hostname-setup.c
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2010-05-05 21:59:24 +0200
committerLennart Poettering <lennart@poettering.net>2010-05-05 22:03:52 +0200
commitd7c114c00030309435fc56c77c8578a25d228ebe (patch)
tree109523f4e06c59157cad7dfa68ff3f6050aa0f32 /hostname-setup.c
parent6c78be3c3c63b59f18311b2d2b0e8d745f6ba131 (diff)
build-sys: add Arch Linux support
Diffstat (limited to 'hostname-setup.c')
-rw-r--r--hostname-setup.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/hostname-setup.c b/hostname-setup.c
index 5f3ee77ac0..67891a52e6 100644
--- a/hostname-setup.c
+++ b/hostname-setup.c
@@ -75,6 +75,47 @@ finish:
fclose(f);
return r;
+#elif defined(TARGET_ARCH)
+ int r;
+ FILE *f;
+
+ assert(hn);
+
+ if (!(f = fopen("/etc/rc.conf", "re")))
+ return -errno;
+
+ for (;;) {
+ char line[LINE_MAX];
+ char *s, *k;
+
+ if (!fgets(line, sizeof(line), f)) {
+ if (feof(f))
+ break;
+
+ r = -errno;
+ goto finish;
+ }
+
+ s = strstrip(line);
+
+ if (!startswith(s, "HOSTNAME="))
+ continue;
+
+ if (!(k = strdup(s+9))) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ *hn = k;
+ break;
+ }
+
+ r = 0;
+
+finish:
+ fclose(f);
+ return r;
+
#elif defined(TARGET_SUSE)
int r;
char *s, *k;