--- install_slash.cpp.orig 2025-08-28 22:33:39.000000000 +0800 +++ install_slash.cpp 2025-09-05 10:24:22.000000000 +0800 @@ -335,21 +335,6 @@ print(ss.str()); print(green + "Welcome to the slash installer! Thank you for choosing slash!\n" + reset); - print("Before installation, you must first confirm:\n"); - print("1. You have the entire slash and slash-utils source code in src/\n"); - print("2. The repository structure is unmodified\n"); - print("3. You are running as sudo (to move the slash binary to /usr/local/bin)\n"); - print("3. You have the following dependencies installed:\n"); - print(cyan + " cmake g++ | libgit2 boost-regex openssl nlohmann::json" + reset + "\n"); - print("If you are curious:\n - cmake and g++ are used for building and compilation\n - libgit2 is for git support in the prompt, and also for read and ls\n - boost-regex is used for syntax highlighting\n - ftxui is used to make TUI apps like pager\n - openssl is simply used to calculate SHA-256 and MD5 in the sumcheck command\n"); - print("Do you meet all the following conditions? (Y/N): "); - - char buffer[2]; - ssize_t bytesRead = read(STDIN_FILENO, buffer, 1); - buffer[bytesRead] = '\0'; - - if(tolower(buffer[0]) == 'n') return 0; - print("Great! Installation will start now.\n\n"); std::string HOME = getenv("HOME"); if(getenv("HOME") == nullptr) { @@ -404,86 +389,6 @@ print("[Setup] Creating ~/.slash/slash-utils\n"); if (create_file(slash_path + "/slash-utils", true) != 0) return 1; - print("[Compilation] Creating temporary 'build' directory\n"); - if (create_file("build", true) != 0) return 1; - - if (chdir("build") != 0) { - error("Failed to enter build directory."); - return 1; - } - - print("[Compilation] Setting up CMake\n"); - if (execute("cmake ..") != 0) return 1; - - print("[Compilation] Building slash...\n"); - if (execute("cmake --build .") != 0) return 1; - - if (chdir("../src/slash-utils") != 0) { - error("Failed to enter src/slash-utils directory: ", true); - return 1; - } - - if(getenv("HOME") == nullptr) { - error("Please set a HOME variable\n"); - return -1; - } - std::string home = getenv("HOME"); - - print("[slash-utils] Creating shared library libslashutils\n"); - system("g++ -std=c++20 -fPIC -shared " - "../abstractions/iofuncs.cpp ../abstractions/info.cpp ../help_helper.cpp " - "../cmd_highlighter.cpp ../abstractions/json.cpp ../tui/tui.cpp ../git/git.cpp " - "-o ~/.slash/slash-utils/libslashutils.so " - "-lgit2 -lssl -lcrypto"); - - const char* ld_path = getenv("LD_LIBRARY_PATH"); - std::string new_ld_path = (ld_path ? std::string(ld_path) : "") + ":" + home + "/.slash/slash-utils"; - setenv("LD_LIBRARY_PATH", new_ld_path.c_str(), 1); - - print("[Compilation] Building all slash-utils. This might take a minute.."); - - std::vector commands = { - "g++ -std=c++20 acart.cpp -o " + home + "/.slash/slash-utils/acart -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 ansi.cpp -o " + home + "/.slash/slash-utils/ansi -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 cmsh.cpp -o " + home + "/.slash/slash-utils/cmsh -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 datetime.cpp -o " + home + "/.slash/slash-utils/datetime -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 dump.cpp -o " + home + "/.slash/slash-utils/dump -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 eol.cpp -o " + home + "/.slash/slash-utils/eol -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 listen.cpp -o " + home + "/.slash/slash-utils/listen -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 move.cpp -o " + home + "/.slash/slash-utils/move -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 perms.cpp -o " + home + "/.slash/slash-utils/perms -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 ascii.cpp -o " + home + "/.slash/slash-utils/ascii -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 create.cpp -o " + home + "/.slash/slash-utils/create -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 del.cpp -o " + home + "/.slash/slash-utils/del -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 echo.cpp -o " + home + "/.slash/slash-utils/echo -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 fnd.cpp -o " + home + "/.slash/slash-utils/fnd -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 ls.cpp -o " + home + "/.slash/slash-utils/ls -L" + home + "/.slash/slash-utils -lslashutils -lgit2", - "g++ -std=c++20 clear.cpp -o " + home + "/.slash/slash-utils/clear -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 csv.cpp -o " + home + "/.slash/slash-utils/csv -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 disku.cpp -o " + home + "/.slash/slash-utils/disku -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 encode.cpp -o " + home + "/.slash/slash-utils/encode -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 mkdir.cpp -o " + home + "/.slash/slash-utils/mkdir -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 pager.cpp -o " + home + "/.slash/slash-utils/pager -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 sumcheck.cpp -o " + home + "/.slash/slash-utils/sumcheck -L" + home + "/.slash/slash-utils -lslashutils -lssl -lcrypto", - "g++ -std=c++20 textmt.cpp -o " + home + "/.slash/slash-utils/textmt -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 netinfo.cpp -o " + home + "/.slash/slash-utils/netinfo -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 ren.cpp -o " + home + "/.slash/slash-utils/ren -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 rf.cpp -o " + home + "/.slash/slash-utils/rf -L" + home + "/.slash/slash-utils -lslashutils -lgit2", - "g++ -std=c++20 srch.cpp -o " + home + "/.slash/slash-utils/srch -L" + home + "/.slash/slash-utils -lslashutils", - "g++ -std=c++20 md.cpp -o " + home + "/.slash/slash-utils/md -L" + home + "/.slash/slash-utils -lslashutils" - }; - - - for(int i = 0; i < commands.size(); i++) { - system(commands[i].c_str()); - } - - print("\x1b[7mPLEASE RUN THE FOLLOWING COMMAND UNDER ROOT\x1b[0m\n"); - print("sudo mv build/slash /usr/local/bin/slash\n\n"); - - print("This is not a slash limitation, but a system limitation.\n"); - print("Running the installer under root will only make slash usable for the root,\n"); - print("just like installing slash will only make it usable for the current user\n"); return 0; }