From 58a72004a0872920196cf717a1a0da512d894899 Mon Sep 17 00:00:00 2001 From: TolaMironcenko Date: Sat, 28 Dec 2024 10:09:29 +0700 Subject: [PATCH] added package and linux deps --- .gitignore | 4 +++- Makefile | 12 ++++++++++-- src/sudo.c | 5 ++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index ef9a4e4..9b6cedc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ bin -.vscode \ No newline at end of file +.vscode +sudo.pkg +sudo.pkg.gz \ No newline at end of file diff --git a/Makefile b/Makefile index 916578e..8790478 100644 --- a/Makefile +++ b/Makefile @@ -12,9 +12,17 @@ build: mkdir bin; \ fi $(CC) -o $(TARGET) $(SOURCES) $(CFLAGS) - sudo chown -v root:staff $(TARGET) - sudo chmod 4755 $(TARGET) + chown -v 0:0 $(TARGET) + chmod 4755 $(TARGET) clean: rm -v $(TARGET) + +package: + mkdir -pv sudo.pkg/usr/bin + cp -v $(TARGET) sudo.pkg/usr/bin/sudo + echo "/usr/bin/sudo" > sudo.pkg/list + printf "#!/bin/sh\nchown -v 0:0 /usr/bin/sudo\nchmod 4755 /usr/bin/sudo" > sudo.pkg/post_install + chmod +x sudo.pkg/post_install + tar -czvf sudo.pkg.gz sudo.pkg \ No newline at end of file diff --git a/src/sudo.c b/src/sudo.c index f4ff9bc..f4297f1 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -2,8 +2,11 @@ #include #include #include -// #include +#include #include +#ifdef __linux__ +#include +#endif void die(char *argv0, char *obj, char *msg) { if (msg == NULL) msg = strerror(errno); -- 2.54.0