diff options
-rw-r--r-- | move/.cvsignore | 1 | ||||
-rw-r--r-- | move/Makefile | 6 | ||||
-rw-r--r-- | move/runlevel_set.c | 25 |
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; +} |