Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 351712 | Differences between
and this patch

Collapse All | Expand All

(-)openrc-0.7.0/work/openrc-0.7.0/src/rc/Makefile (-4 / +19 lines)
Lines 47-52 include ${MK}/${MKPAM}.mk Link Here
47
47
48
${SRCS}: version.h
48
${SRCS}: version.h
49
49
50
#create symlinks to rc if not an SELINUX system, otherwise create a wrapper
51
#script to call rc with the proper name of the applet to execute.
52
#$1 is the path+name of the target to link to (usually 'rc' or '/sbin/rc')
53
#$2 contains the path+name of the link
54
define make-links
55
	for x in $1; do \
56
		if test -n "${SELINUX}"; then \
57
			printf '#!/bin/sh\nexec $2 --applet %s "$$@"\n' $$x >$3$$x; \
58
			chmod a+rx $3$$x; \
59
		else \
60
			ln -sf $2 $3$$x; \
61
		fi; \
62
	done;
63
endef
64
50
.PHONY:	version.h.tmp
65
.PHONY:	version.h.tmp
51
version.h.tmp:
66
version.h.tmp:
52
	echo "#define VERSION \"${VERSION}${GITVER}\"" >$@
67
	echo "#define VERSION \"${VERSION}${GITVER}\"" >$@
Lines 61-73 install: all Link Here
61
	${INSTALL} -d ${DESTDIR}${SBINDIR}
76
	${INSTALL} -d ${DESTDIR}${SBINDIR}
62
	${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${SBINDIR}
77
	${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${SBINDIR}
63
	${INSTALL} -d ${DESTDIR}${BINDIR}
78
	${INSTALL} -d ${DESTDIR}${BINDIR}
64
	for x in ${BINLINKS}; do ln -fs ${SBINDIR}/${PROG} ${DESTDIR}${BINDIR}/$$x; done
79
		$(call make-links,${BINLINKS},${SBINDIR}/${PROG},${DESTDIR}${BINDIR}/)
65
	${INSTALL} -d ${DESTDIR}${SBINDIR}
80
	${INSTALL} -d ${DESTDIR}${SBINDIR}
66
	for x in ${SBINLINKS}; do ln -fs ${PROG} ${DESTDIR}${SBINDIR}/$$x; done
81
		$(call make-links,${SBINLINKS},${PROG},${DESTDIR}${SBINDIR}/)
67
	${INSTALL} -d ${DESTDIR}${LINKDIR}/bin
82
	${INSTALL} -d ${DESTDIR}${LINKDIR}/bin
68
	for x in $(RC_BINLINKS); do ln -fs ${SBINDIR}/${PROG} ${DESTDIR}${LINKDIR}/bin/$$x; done
83
		$(call make-links,${RC_BINLINKS},${SBINDIR}/${PROG},${DESTDIR}${LINKDIR}/bin/)
69
	${INSTALL} -d ${DESTDIR}${LINKDIR}/sbin
84
	${INSTALL} -d ${DESTDIR}${LINKDIR}/sbin
70
	for x in ${RC_SBINLINKS}; do ln -fs ${SBINDIR}/${PROG} ${DESTDIR}${LINKDIR}/sbin/$$x; done
85
		$(call make-links,${RC_SBINLINKS},${SBINDIR/${PROG},${DESTDIR}${LINKDIR}/sbin/)
71
	if test "${MKPAM}" = pam; then \
86
	if test "${MKPAM}" = pam; then \
72
		${INSTALL} -d ${DESTDIR}${PAMDIR}; \
87
		${INSTALL} -d ${DESTDIR}${PAMDIR}; \
73
		${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
88
		${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
(-)openrc-0.7.0/work/openrc-0.7.0/src/rc/rc.c (-4 / +26 lines)
Lines 773-783 handle_bad_signal(int sig) Link Here
773
#endif
773
#endif
774
774
775
#include "_usage.h"
775
#include "_usage.h"
776
#define getoptstring "o:s:S" getoptstring_COMMON
776
#define getoptstring "o:s:S:a" getoptstring_COMMON
777
static const struct option longopts[] = {
777
static const struct option longopts[] = {
778
	{ "override", 1, NULL, 'o' },
778
	{ "override", 1, NULL, 'o' },
779
	{ "service",  1, NULL, 's' },
779
	{ "service",  1, NULL, 's' },
780
	{ "sys",      0, NULL, 'S' },
780
	{ "sys",      0, NULL, 'S' },
781
	{ "applet",   1, NULL, 'a' },
781
	longopts_COMMON
782
	longopts_COMMON
782
};
783
};
783
static const char * const longopts_help[] = {
784
static const char * const longopts_help[] = {
Lines 785-790 static const char * const longopts_help[ Link Here
785
	"when leaving single user or boot runlevels",
786
	"when leaving single user or boot runlevels",
786
	"runs the service specified with the rest\nof the arguments",
787
	"runs the service specified with the rest\nof the arguments",
787
	"output the RC system type, if any",
788
	"output the RC system type, if any",
789
	"runs the applet specified by the next argument",
788
	longopts_help_COMMON
790
	longopts_help_COMMON
789
};
791
};
790
#include "_usage.c"
792
#include "_usage.c"
Lines 835-841 main(int argc, char **argv) Link Here
835
	}
837
	}
836
838
837
	/* Run our built in applets. If we ran one, we don't return. */
839
	/* Run our built in applets. If we ran one, we don't return. */
838
	run_applets(argc, argv);
840
	{
841
		//make these local vars
842
		int localargc = argc;
843
		char **localargv = argv;
844
		if(-1 != (opt = getopt_long(argc, argv, getoptstring, longopts,
845
		  (int *)0))) {
846
			if(opt == 'a' && argc >= 3) {
847
				//pass modified argc,argv, because the applets
848
				//expect their arguments starting at argv[1]
849
				localargv = argv + 2;
850
				localargc = argc - 2;
851
				applet = argv[2];
852
			}
853
		}
854
855
		optind = 0; //reset getopt_long
856
		run_applets(localargc, localargv);
857
	}
839
858
840
	argc--;
859
	argc--;
841
	argv++;
860
	argv++;
Lines 890-897 main(int argc, char **argv) Link Here
890
			}
909
			}
891
			exit(EXIT_SUCCESS);
910
			exit(EXIT_SUCCESS);
892
			/* NOTREACHED */
911
			/* NOTREACHED */
893
			case_RC_COMMON_GETOPT
912
		case 'a':
894
			    }
913
			/* Do nothing, actual logic in run_applets, this
914
			   is a placeholder */
915
		case_RC_COMMON_GETOPT
916
		}
895
	}
917
	}
896
918
897
	newlevel = argv[optind++];
919
	newlevel = argv[optind++];

Return to bug 351712