From: Tobias Ulmer Date: Mon, 10 Sep 2012 17:56:19 +0000 (+0200) Subject: Remove e2-su and e2-root X-Git-Tag: e2factory-2.3.13rc1~106 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=233fa7fb2b1e908358b399380e05a7d6b2aaa91d;p=e2factory.git Remove e2-su and e2-root e2-su was used up until e2-2.2pre13 (never released to the public). It was the only user of e2-root.lua. e2factory until e2factory-2.3.12 will still check for the presence of e2-su, therefore supply a small shellscript that makes previous versions happy. Signed-off-by: Tobias Ulmer --- diff --git a/generic/tools.lua b/generic/tools.lua index 49c7079..20d74aa 100644 --- a/generic/tools.lua +++ b/generic/tools.lua @@ -57,8 +57,6 @@ local toollist = { patch = { name = "patch", flags = "", optional = false }, gzip = { name = "gzip", flags = "", optional = false }, unzip = { name = "unzip", flags = "", optional = false }, - ["e2-su"] = { name = buildconfig.PREFIX .. "/bin/e2-su", flags = "", - optional = false }, ["e2-su-2.2"] = { name = buildconfig.PREFIX .. "/bin/e2-su-2.2", flags = "", optional = false }, } diff --git a/global/Makefile b/global/Makefile index adc0ae2..7ce1086 100644 --- a/global/Makefile +++ b/global/Makefile @@ -32,10 +32,10 @@ include $(TOPLEVEL)/make.vars VPATH = .:$(TOPLEVEL)/generic:$(TOPLEVEL) SCRIPTS = -GLOBALLUATOOLS = e2-create-project e2-fetch-project e2-install-e2 e2-root -GLOBALSHTOOLS = e2-locate-project-root e2ssh +GLOBALLUATOOLS = e2-create-project e2-fetch-project e2-install-e2 +GLOBALSHTOOLS = e2-locate-project-root e2ssh e2-su GLOBALTOOLS = $(GLOBALLUATOOLS) $(GLOBALSHTOOLS) -CLEAN_FILES = e2 e2-su e2.conf +CLEAN_FILES = e2 e2.conf LUA_LIBS = strict.lua plugin.lua e2lib.lua LUA_LIBS += e2option.lua hash.lua tools.lua transport.lua cache.lua url.lua LUA_LIBS += generic_git.lua luafile.lua err.lua lock.lua @@ -43,7 +43,7 @@ LUA_LIBS += buildconfig.lua .PHONY: all install uninstall clean -all: e2 $(SCRIPTS) e2-su \ +all: e2 $(SCRIPTS) \ $(GLOBALSHTOOLS:=.sh) e2.conf sha1.so e2-su-2.2 \ luafile_ll.so e2util.so @@ -68,7 +68,6 @@ install: all install-dirs install-lua for i in $(GLOBALSHTOOLS) ; do \ install -m 755 $$i.sh $(DESTDIR)$(BINDIR)/$$i ; \ done - $(SUDO) install -m 4754 -o root -g $(E2_GROUP) e2-su $(DESTDIR)$(BINDIR)/ install -m 755 e2 $(DESTDIR)$(BINDIR)/ if [ ! -f "$(DESTDIR)$(SYSCONFDIR)/e2.conf" ] ; then \ install -m 644 e2.conf $(DESTDIR)$(SYSCONFDIR)/e2.conf ; \ @@ -91,8 +90,6 @@ uninstall: rm -f $(DESTDIR)$(BINDIR)/e2-su-2.2 rm -f $(DESTDIR)$(LIBDIR)/luafile_ll.so rm -f $(DESTDIR)$(LIBDIR)/e2util.so - rm -f $(DESTDIR)$(TOOLDIR)/e2-root - rm -f $(DESTDIR)$(BINDIR)/e2-su rm -f $(DESTDIR)$(BINDIR)/e2 doc: @@ -111,9 +108,6 @@ clean: %.lua: %.lua.in $(TOPLEVEL)/scripts/genscript.sh $< $@ -e2-su: e2-su.c - $(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@ - %.sh: %.sh.in $(TOPLEVEL)/scripts/genscript.sh $< $@ diff --git a/global/e2-root.lua b/global/e2-root.lua deleted file mode 100644 index 3a500b6..0000000 --- a/global/e2-root.lua +++ /dev/null @@ -1,190 +0,0 @@ ---[[ - e2factory, the emlix embedded build system - - Copyright (C) 2007-2009 Gordon Hecker , emlix GmbH - Copyright (C) 2007-2009 Oskar Schirmer , emlix GmbH - Copyright (C) 2007-2008 Felix Winkelmann, emlix GmbH - - For more information have a look at http://www.e2factory.org - - e2factory is a registered trademark by emlix GmbH. - - This file is part of e2factory, the emlix embedded build system. - - e2factory is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -]] - -env_tool = "@ENV_TOOL@" -chroot_tool = "@CHROOT_TOOL@" -tar_tool = "@TAR_TOOL@" -chown_tool = "@CHOWN_TOOL@" -rm_tool = "@RM_TOOL@" - -compat_2_1 = true -- be compatible with e2-2.1? - -function assert_chroot_environment(path) - local fname = string.format("%s/emlix-chroot", path) - local f = io.open(fname, "r") - if not f then - print("not a chroot environment") - os.exit(99) - end - f:close() - return true -end - --- e2-root ... -if arg[1] == "chroot_2_2" then - -- 2_2_chroot - local path = arg[2] - local command = arg[3] - if (not path) or (not command) or #arg ~= 3 then - print("wrong arguments") - os.exit(99) - end - assert_chroot_environment(path) - local cmd = string.format("%s -i %s '%s' %s", env_tool, chroot_tool, path, - command) - local rc = os.execute(cmd) - os.exit(rc/256) -elseif arg[1] == "extract_tar_2_2" then - -- extract_tar_2_2 - local path = arg[2] - local tartype = arg[3] - local file = arg[4] - if (not path) or (not tartype) or (not file) or #arg ~= 4 then - print("wrong arguments") - os.exit(99) - end - assert_chroot_environment(path) - if tartype == "tar.gz" then - tarflags = "-z" - elseif tartype == "tar.bz2" then - tarflags = "-j" - elseif tartype == "tar" then - tarflags = "" - end - local cmd = string.format("%s -i %s %s -C '%s' -xf '%s'", - env_tool, tar_tool, tarflags, path, file) - local rc = os.execute(cmd) - os.exit(rc/256) -elseif arg[1] == "set_permissions_2_2" then - -- set_permissions_2_2 - local path = arg[2] - if (not path) then - print("wrong arguments") - os.exit(99) - end - assert_chroot_environment(path) - local cmd = string.format("%s -i %s root:root '%s'", env_tool, chown_tool, - path) - local rc = os.execute(cmd) - os.exit(rc/256) -elseif arg[1] == "remove_chroot_2_2" then - -- remove_chroot_2_2 - local path = arg[2] - if (not path) then - print("wrong arguments") - os.exit(99) - end - assert_chroot_environment(path) - local cmd = string.format("%s -i %s -fr '%s'", env_tool, rm_tool, path) - local rc = os.execute(cmd) - os.exit(rc/256) -end - --- e2-root <...> - -if not compat_2_1 then - print("unknown command") - os.exit(3) -end - -if #arg < 4 then - print("too few arguments") - os.exit(3) -end - -local call = {} -call.username = os.getenv("USER") -if not call.username then - print("can't get USER environment variable") - os.exit(3) -end -call.cmd = arg[1] -call.tmpdir = arg[2] .. "/e2build" -call.proj = arg[3] -call.result = arg[4] -call.chroot_path = call.tmpdir .. "/" .. call.username .. "/" .. -call.proj .. "/" .. call.result .. "/chroot" - -local rc = 1 -if call.cmd == "setup-chroot" then - rc = os.execute("mkdir -p " .. call.chroot_path .. - " && touch \"" .. call.chroot_path .. "/emlix-chroot\"") - os.exit(rc/256) - -elseif call.cmd == "extract-tar" then - call.file = arg[5] - local opts = "-xzf" - if string.match(call.file, ".bz2$") then - opts = "-xjf" - elseif string.match(call.file, ".tar$") then - opts = "-xf" - end - rc = os.execute("tar -C \"" .. call.chroot_path .. - "\" " .. opts .. " \"" .. call.file .. "\"") - os.exit(rc/256) - -elseif call.cmd == "prepare" then - rc = os.execute("PATH=/usr/sbin:/sbin:$PATH " .. - "T=\"/tmp/e2\" " .. - "r=\"" .. call.result .. "\" " .. - "chroot " .. call.chroot_path .. " " .. - "/bin/bash -e -x \"/tmp/e2/script/e2-runbuild-unpack-source\"") - os.exit(rc/256) - -elseif call.cmd == "runbuild" then - rc = os.execute("PATH=/usr/sbin:/sbin:$PATH " .. - "T=\"/tmp/e2\" " .. - "r=\"" .. call.result .. "\" " .. - "chroot " .. call.chroot_path .. " " .. - "/bin/bash -e -x \"/tmp/e2/script/e2-runbuild-build\"") - os.exit(rc/256) - -elseif call.cmd == "enter" then - local cmd = arg[5] - if cmd then - command = string.format(" -c \"%s\"", cmd) - else - command = "" - end - rc = os.execute("PATH=/usr/sbin:/sbin:$PATH " .. - "T=\"/tmp/e2\" " .. - "r=\"" .. call.result .. "\" " .. - "chroot " .. call.chroot_path .. " " .. - "/bin/bash --rcfile \"/tmp/e2/script/e2-runbuildrc\"" .. - command) - os.exit(rc/256) - -elseif call.cmd == "rm-chroot" then - rc = os.execute("rm -fr \"" .. call.chroot_path .. "\"") - os.exit(rc/256) - -end - -print("unknown command") -os.exit(3) - --- vim:sw=4:sts=4:et: diff --git a/global/e2-su.c b/global/e2-su.c deleted file mode 100644 index 2453b44..0000000 --- a/global/e2-su.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - e2factory, the emlix embedded build system - - Copyright (C) 2007-2009 Gordon Hecker , emlix GmbH - Copyright (C) 2007-2009 Oskar Schirmer , emlix GmbH - Copyright (C) 2007-2008 Felix Winkelmann, emlix GmbH - - For more information have a look at http://www.e2factory.org - - e2factory is a registered trademark by emlix GmbH. - - This file is part of e2factory, the emlix embedded build system. - - e2factory is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef TOOLDIR -#error TOOLDIR not defined -#endif -#ifndef E2_ROOT_TOOL_NAME -#define E2_ROOT_TOOL_NAME "e2-root" -#endif -#ifndef E2_ROOT_TOOL_PATH -#define E2_ROOT_TOOL_PATH TOOLDIR "/" E2_ROOT_TOOL_NAME -#endif - -char *tool_name = E2_ROOT_TOOL_NAME; -char *tool_path = E2_ROOT_TOOL_PATH; - -int main(int argc, char *argv[]) -{ - int rc; - int i; - char *arg [ 1024 ]; - - if(argc < 2) { - fprintf(stderr, "this tool is not intended to be executed directly\n"); - exit(1); - } - - int k = 0; - arg[k++] = tool_name; - for(i=1; argv[i]; i++) { - if(argv[i][0] == '-') - continue; - arg[k++] = argv[i]; - //fprintf(stderr, "%s\n"); - } - arg[k] = NULL; - - if(getenv("DEBUG")) { - printf("%s\n", E2_ROOT_TOOL_PATH); - for(i=0; arg[i]; i++) { - printf("\"%s\"\n", arg[i]); - } - } - - rc = setuid(0); - if(rc != 0) { - perror("can't setuid(0)"); - exit(1); - } - - rc = setgid(0); - if(rc != 0) { - perror("can't setgid(0)"); - exit(1); - } - - rc = setgroups(0, NULL); - if(rc != 0) { - perror("can't setgroups()"); - exit(1); - } - - rc = execvp(E2_ROOT_TOOL_PATH, arg); - perror("can't exec"); - exit(3); -} diff --git a/global/e2-su.sh b/global/e2-su.sh new file mode 100644 index 0000000..f777cec --- /dev/null +++ b/global/e2-su.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +# This tool is __unused__ since e2-2.2pre14. Its presence is still checked for +# up until e2factory-2.3.12. It must therefore be present until +# e2factory-2.3.12 is not supported anymore. + +# This tool should never be called by any version of e2factory that is still +# supported. Always signal an error. + +echo "e2-su is not supported! It exists for backwards compatibility only." >&2 +exit 1