diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 7543e0f..2f6548a 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -14,5 +14,5 @@ jobs: steps: - uses: actions/checkout@v4 - name: 编译 - run: gcc -I../include src/bootstrap.c src/Utils/cmd_utils.c src/Utils/install_utils.c src/Utils/shell_utils.c src/Utils/updata_utils.c src/LoginShell/ExamAll.c src/FileManagement/FileInfo.c src/Library/PrintColor.c src/Library/Version.c -o cil + run: gcc objs/bootstrap.o objs/cmd_utils.o objs/install_utils.o objs/shell_utils.o objs/ExamAll.o objs/FileInfo.o objs/updata_utils.o objs/Version.o -o cil -L./lib -lprintcolor diff --git a/Makefile b/Makefile index 91ff53e..5b14282 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,28 @@ CC = gcc CFLAGS = -I./includes -Wall -OBJFILES = objs/bootstrap.o objs/cmd_utils.o objs/install_utils.o objs/shell_utils.o objs/ExamAll.o objs/FileSize.o objs/PrintColor.o +OBJFILES = objs/bootstrap.o objs/cmd_utils.o objs/install_utils.o objs/shell_utils.o objs/ExamAll.o objs/FileInfo.o objs/updata_utils.o objs/Version.o TARGET = cil +LIBTARGET = lib/libprintcolor.a +LIBOBJS = objs/PrintColor.o all: $(TARGET) objs: @mkdir -p objs -objs/bootstrap.o: src/bootstrap.c objs + + +objs/PrintColor.o: src/Library/PrintColor.c objs $(CC) $(CFLAGS) -c $< -o $@ -objs/cmd_utils.o: src/Utils/cmd_utils.c objs +$(LIBTARGET): $(LIBOBJS) + @mkdir -p lib + cd lib && $(AR) rcs $(notdir $(LIBTARGET)) ../$(LIBOBJS) + + + + +objs/bootstrap.o: src/bootstrap.c objs $(CC) $(CFLAGS) -c $< -o $@ objs/install_utils.o: src/Utils/install_utils.c objs @@ -23,15 +34,26 @@ objs/shell_utils.o: src/Utils/shell_utils.c objs objs/ExamAll.o: src/LoginShell/ExamAll.c objs $(CC) $(CFLAGS) -c $< -o $@ -objs/FileSize.o: src/FileManagement/FileSize.c objs +objs/FileInfo.o: src/FileManagement/FileInfo.c objs $(CC) $(CFLAGS) -c $< -o $@ -objs/PrintColor.o: src/Library/PrintColor.c objs +objs/cmd_utils.o: src/Utils/cmd_utils.c objs $(CC) $(CFLAGS) -c $< -o $@ +objs/updata_utils.o: src/Utils/updata_utils.c objs + $(CC) $(CFLAGS) -c $< -o $@ + +objs/Version.o: src/Utils/Version.c objs + $(CC) $(CFLAGS) -c $< -o $@ + + + + +$(TARGET): $(OBJFILES) $(LIBTARGET) + $(CC) $(OBJFILES) -o $(TARGET) -L./lib -lprintcolor + + -$(TARGET): $(OBJFILES) - $(CC) $(OBJFILES) -o $(TARGET) clean: - rm -f $(OBJFILES) $(TARGET) \ No newline at end of file + rm -f $(OBJFILES) $(TARGET) $(LIBTARGET) \ No newline at end of file diff --git a/cil.repo b/cil.repo new file mode 100644 index 0000000..e69de29 diff --git a/cil.spec b/cil.spec new file mode 100644 index 0000000..f0852ae --- /dev/null +++ b/cil.spec @@ -0,0 +1,31 @@ +Summary: A short description of your software +Name: mysoftware +Version: 1.0 +Release: 1%{?dist} +License: GPL +Group: Development/Tools +Source: %{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot +%description +A detailed description of your software. + +%prep +%setup -q + +%build +make + +%install +make DESTDIR=%{buildroot} install + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%doc README.txt LICENSE.txt +%{_bindir}/mysoftware + +%changelog +* Tue Dec 31 2013 Your Name - 1.0-1 +- Initial release. \ No newline at end of file diff --git a/lib/libprintcolor.a b/lib/libprintcolor.a new file mode 100644 index 0000000..da34c45 Binary files /dev/null and b/lib/libprintcolor.a differ diff --git a/objs/ExamAll.o b/objs/ExamAll.o new file mode 100644 index 0000000..aaafb36 Binary files /dev/null and b/objs/ExamAll.o differ diff --git a/objs/FileInfo.o b/objs/FileInfo.o new file mode 100644 index 0000000..2c52510 Binary files /dev/null and b/objs/FileInfo.o differ diff --git a/objs/PrintColor.o b/objs/PrintColor.o new file mode 100644 index 0000000..8ad7bed Binary files /dev/null and b/objs/PrintColor.o differ diff --git a/objs/Version.o b/objs/Version.o new file mode 100644 index 0000000..580bb2c Binary files /dev/null and b/objs/Version.o differ diff --git a/objs/bootstrap.o b/objs/bootstrap.o new file mode 100644 index 0000000..fa764d0 Binary files /dev/null and b/objs/bootstrap.o differ diff --git a/objs/cmd_utils.o b/objs/cmd_utils.o new file mode 100644 index 0000000..812160f Binary files /dev/null and b/objs/cmd_utils.o differ diff --git a/objs/install_utils.o b/objs/install_utils.o new file mode 100644 index 0000000..eff13bf Binary files /dev/null and b/objs/install_utils.o differ diff --git a/objs/shell_utils.o b/objs/shell_utils.o new file mode 100644 index 0000000..6922d7d Binary files /dev/null and b/objs/shell_utils.o differ diff --git a/objs/updata_utils.o b/objs/updata_utils.o new file mode 100644 index 0000000..efe171e Binary files /dev/null and b/objs/updata_utils.o differ diff --git a/src/FileManagement/FileCurl.c b/src/FileManagement/FileCurl_no.c similarity index 100% rename from src/FileManagement/FileCurl.c rename to src/FileManagement/FileCurl_no.c diff --git a/src/Library/Version.c b/src/Utils/Version.c similarity index 88% rename from src/Library/Version.c rename to src/Utils/Version.c index 170a39e..b03ae41 100644 --- a/src/Library/Version.c +++ b/src/Utils/Version.c @@ -7,7 +7,7 @@ void print_version(const char *script){ if (strcmp(script, "version") == 0){ - char version[] = "3.0"; + char version[] = "3.0.1"; // 使用printf函数打印版本号 printf("当前版本是: %s\n", version); diff --git a/src/Utils/cmd_utils.c b/src/Utils/cmd_utils.c index 85533e8..4a502a8 100644 --- a/src/Utils/cmd_utils.c +++ b/src/Utils/cmd_utils.c @@ -1,11 +1,14 @@ #include "../../includes/cmd_utils.h" +#include "PrintColor.h" + #include #include #include void show_command_usage(const char *command) { if (strcmp(command, "nginx") == 0) { - printf("\033[1;34mNginx常用命令:\033[0m\n"); + + color_printf(cyan,"Nginx常用命令:\n"); printf("\033[1;34m1. 查看Nginx版本:nginx -v\033[0m\n"); printf("\033[1;34m2. 检查Nginx配置文件:nginx -t\033[0m\n"); printf("\033[1;34m3. 重启Nginx:sudo systemctl restart nginx \033[0m\n"); diff --git a/src/bootstrap.c b/src/bootstrap.c index 6777631..df302cd 100644 --- a/src/bootstrap.c +++ b/src/bootstrap.c @@ -1,16 +1,23 @@ #include #include + + +#include "PrintColor.h" // 静态链接库 + #include "../includes/cmd_utils.h" #include "../includes/install_utils.h" #include "../includes/shell_utils.h" #include "../includes/ExamAll.h" #include "../includes/FileInfo.h" -#include "../includes/PrintColor.h" #include "../includes/updata_utils.h" #include "../includes/Version.h" +// 也许需要一个系统匹配版本调度程序 + + + int main(int argc, char *argv[]) { if (argc == 1) { // argc参数为1时 @@ -53,5 +60,3 @@ int main(int argc, char *argv[]) { return 0; } -// 编译:gcc -I../include src/bootstrap.c src/Utils/cmd_utils.c src/Utils/install_utils.c src/Utils/shell_utils.c src/Utils/updata_utils.c src/LoginShell/ExamAll.c src/FileManagement/FileInfo.c src/Library/PrintColor.c src/Library/Version.c -o cil -// 注意:确保在编译时包含install_utils.c,因为install_scripts函数定义在此文件中。 \ No newline at end of file diff --git a/src/git/clone_no.c b/src/git/clone_no.c new file mode 100644 index 0000000..e69de29 diff --git a/src/git/push_no.c b/src/git/push_no.c new file mode 100644 index 0000000..e69de29