summaryrefslogtreecommitdiffstats
path: root/move
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-11-20 22:55:51 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-11-20 22:55:51 +0000
commit258f9f1304d54140a89a362d9baa55eef3f8faf1 (patch)
treeb55562c1cc5561ea1f0b6a82c7ffbf2957ac794e /move
parent7cd6040f7101a94c006cc6360ea2f2c7f80051b9 (diff)
downloaddrakx-258f9f1304d54140a89a362d9baa55eef3f8faf1.tar
drakx-258f9f1304d54140a89a362d9baa55eef3f8faf1.tar.gz
drakx-258f9f1304d54140a89a362d9baa55eef3f8faf1.tar.bz2
drakx-258f9f1304d54140a89a362d9baa55eef3f8faf1.tar.xz
drakx-258f9f1304d54140a89a362d9baa55eef3f8faf1.zip
found no way to write into /var/run/utmp than to create my own program :(
Diffstat (limited to 'move')
-rw-r--r--move/.cvsignore1
-rw-r--r--move/Makefile6
-rw-r--r--move/runlevel_set.c25
3 files changed, 31 insertions, 1 deletions
diff --git a/move/.cvsignore b/move/.cvsignore
index 3e5b5c985..0600e5070 100644
--- a/move/.cvsignore
+++ b/move/.cvsignore
@@ -1,3 +1,4 @@
+runlevel_set
*.rdz
xwait
.perl_checker.cache
diff --git a/move/Makefile b/move/Makefile
index 3e727c983..e775d9b0b 100644
--- a/move/Makefile
+++ b/move/Makefile
@@ -26,7 +26,7 @@ endif
all: install
-build: xwait isolinux/boot.msg
+build: xwait runlevel_set isolinux/boot.msg
cd $(STAGE1) && ADDITIONAL_DEFS="-DMANDRAKE_MOVE" MOVE=1 make init stage1-network stage1-cdrom init-move
sudo ./collect-directories-to-create.pl $(DEST_LIVETREE) > data/directories-to-create
sudo find $(DEST_LIVETREE)/etc -type f | perl -pe 's|$(DEST_LIVETREE)||' > data/all-etcfiles
@@ -42,6 +42,7 @@ install: build
$(MAKE) -C ../perl-install/share/po install NAME=libDrakX DATADIR=$(DEST_LIVETREE)/usr/share
sudo cp -f xwait $(DEST_LIVETREE)/usr/bin
+ sudo cp -f runlevel_set $(DEST_LIVETREE)/usr/bin
sudo cp -f runstage2 $(DEST_LIVETREE)/usr/bin/runstage2.pl
sudo rm -rf $(DEST_STAGE2)
sudo mkdir -p $(DEST_STAGE2)
@@ -108,6 +109,9 @@ iso: un_live_tree_boot install live_tree_boot
xwait: %: %.c
$(CC) $(CFLAGS) $< -L/usr/X11R6/$(LIB_NAME) -lX11 -o $@
+runlevel_set: %: %.c
+ $(CC) $(CFLAGS) $< -o $@
+
clean:
rm -f xwait
diff --git a/move/runlevel_set.c b/move/runlevel_set.c
new file mode 100644
index 000000000..94f7b5933
--- /dev/null
+++ b/move/runlevel_set.c
@@ -0,0 +1,25 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <utmp.h>
+
+int main(int argc, char **argv)
+{
+ struct utmp utmp;
+
+ if (argc <= 1) {
+ fprintf(stderr, "need an argument\n");
+ return 1;
+ }
+
+ memset(&utmp, 0, sizeof(utmp));
+ utmp.ut_type = RUN_LVL;
+ utmp.ut_pid = argv[1][0];
+
+ setutent();
+ pututline(&utmp);
+ endutent();
+
+ return 0;
+}