apache, nginx, tor, fdisk

This commit is contained in:
2026-02-21 18:03:07 +01:00
parent 6559569986
commit 917ffadc6a
17 changed files with 114 additions and 17 deletions

View File

@@ -1 +1 @@
Checks: '*,clang-analyzer-*,-llvmlibc-*,-fuchsia-*,-altera-*,-abseil-*,-android-*,-modernize-use-trailing-return-type,-readability-identifier-length,-*-readability-todo,-*-magic-numbers,-readability-function-cognitive-complexity,-*-easily-swappable-parameters,-*-non-private-member-variables-in-classes,-*-no-recursion,-concurrency-mt-unsafe,-*-runtime-int,-*-non-const-global-variables,-performance-inefficient-string-concatenation,-cert-err58-cpp,-*-signed-bitwise'
Checks: '*,clang-analyzer-*,-llvmlibc-*,-fuchsia-*,-altera-*,-abseil-*,-android-*,-modernize-use-trailing-return-type,-readability-identifier-length,-*-readability-todo,-*-magic-numbers,-readability-function-cognitive-complexity,-*-easily-swappable-parameters,-*-non-private-member-variables-in-classes,-*-no-recursion,-concurrency-mt-unsafe,-*-runtime-int,-*-non-const-global-variables,-performance-inefficient-string-concatenation,-cert-err58-cpp,-*-signed-bitwise'

View File

@@ -3,6 +3,7 @@ project(shrap)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(SQLITE_OMIT_LOAD_EXTENSION ON CACHE BOOL "Disable SQLite load_extension()" FORCE)
find_package(blake3 REQUIRED)
@@ -18,4 +19,4 @@ add_executable(${PROJECT_NAME} src/main.cc)
target_link_libraries(${PROJECT_NAME} PRIVATE blake3 SQLiteCpp)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-static")
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-static")

13
packages/apache.shrap Normal file
View File

@@ -0,0 +1,13 @@
(package
(name "apache")
(version "2.4.66")
(homepage "https://httpd.apache.org/")
(dependencies libpcre2 libapr-util curl libnghttp2 libjansson)
(src (tar
(url "https://dlcdn.apache.org/httpd/httpd-2.4.66.tar.gz")
(dir "httpd-2.4.66")
(blake3 "5e85077659e0afb6e51ba017b6a8807b74b53be28bd7d4e9e1821c96600b1fb2")))
(build
(configure_make
(configure_flags "--enable-ssl --enable-mods-shared=\"all cgi\""))
(shell "sed -i 's|^#LoadModule ssl_module|LoadModule ssl_module|' /usr/conf/httpd.conf")))

View File

@@ -0,0 +1,12 @@
(package
(name "libapr-util")
(version "1.6.3")
(homepage "https://apr.apache.org/")
(dependencies libapr libexpat)
(src (tar
(url "https://dlcdn.apache.org//apr/apr-util-1.6.3.tar.gz")
(dir "apr-util-1.6.3")
(blake3 "a887fcd96b9c9dc5c1039a6ae6b7df5baab22a54ee18ce2ebde6e902e3d3a3da")))
(build
(configure_make
(configure_flags "--with-apr=/usr/bin/apr-1-config"))))

12
packages/libapr.shrap Normal file
View File

@@ -0,0 +1,12 @@
(package
(name "libapr")
(version "1.7.6")
(homepage "https://apr.apache.org/")
(dependencies make libopenssl)
(src (tar
(url "https://dlcdn.apache.org//apr/apr-1.7.6.tar.gz")
(dir "apr-1.7.6")
(blake3 "d8f55af9e3d5c0548c5a6c2345cf22ea98c1960874caff81aa168e32f0c2f159")))
(build
(configure_make
(configure_flags "--with-crypto"))))

11
packages/libjansson.shrap Normal file
View File

@@ -0,0 +1,11 @@
(package
(name "libjansson")
(version "2.15.0")
(homepage "https://github.com/akheron/jansson")
(dependencies make)
(src (tar
(url "https://github.com/akheron/jansson/releases/download/v2.15.0/jansson-2.15.0.tar.gz")
(dir "jansson-2.15.0")
(blake3 "53432e6ba17b7ad7640c397c5f382eb2d6dbb7f22d13f04078454c7a6affe4bd")))
(build
(configure_make)))

11
packages/libnghttp2.shrap Normal file
View File

@@ -0,0 +1,11 @@
(package
(name "libnghttp2")
(version "1.68.0")
(homepage "https://nghttp2.org/")
(dependencies make)
(src (tar
(url "https://github.com/nghttp2/nghttp2/releases/download/v1.68.0/nghttp2-1.68.0.tar.gz")
(dir "nghttp2-1.68.0")
(blake3 "1894c685f2aaad1112757fdb525bbd2305ddda3975b0cdb68a80d36184934093")))
(build
(configure_make)))

View File

@@ -8,4 +8,5 @@
(dir "pcre2-10.47")
(blake3 "e80086b5f6da0896be2bb6d0d94ba976a6b21a43fddb831a189d2c8c9747d962")))
(build
(configure_make)))
(configure_make
(configure_flags "--disable-shared"))))

12
packages/nginx.shrap Normal file
View File

@@ -0,0 +1,12 @@
(package
(name "nginx")
(version "1.29.5")
(homepage "https://nginx.org/")
(dependencies libpcre2 zlib libopenssl)
(src (tar
(url "https://nginx.org/download/nginx-1.29.5.tar.gz")
(dir "nginx-1.29.5")
(blake3 "e37ca0ef47e09e907952840dc29cf3b8eef59d90894eb585fcafc8ec62aebbd1")))
(build
(configure_make
(configure_flags "--with-http_ssl_module --with-http_v2_module --with-http_v3_module --with-threads"))))

View File

@@ -2,7 +2,7 @@
(name "php")
(version "8.5.3")
(homepage "https://www.php.net/")
(dependencies pkg-config libxml2 sqlite3 libreadline libopenssl zlib bzip2 curl libpng libwebp libfreetype libicu liboniguruma)
(dependencies pkg-config libxml2 sqlite3 libreadline zlib bzip2 curl libpng libwebp libfreetype libicu liboniguruma)
(src (tar
(url "https://www.php.net/distributions/php-8.5.3.tar.gz")
(dir "php-8.5.3")

View File

@@ -2,7 +2,7 @@
(name "python")
(version "3.14.3")
(homepage "https://www.python.org/")
(dependencies zlib libopenssl bzip2)
(dependencies zlib libopenssl bzip2 libffi sqlite3 libdb libreadline)
(src (tar
(url "https://www.python.org/ftp/python/3.14.3/Python-3.14.3.tgz")
(dir "Python-3.14.3")

View File

@@ -8,9 +8,9 @@
(dir "rustc-1.93.1-src")
(blake3 "c8f492b93a95d64efb51fbcc5eab1e8edc1468a3f5be923c756b69d66892161a")))
(build
(shell "cp bootstrap.example.toml bootstrap.toml || true")
(shell "cp -v bootstrap.example.toml bootstrap.toml || true")
(shell "sed -i '1illvm.targets = \"X86\"' bootstrap.toml")
(shell "sed -i '1ibuild.docs = false' bootstrap.toml")
(shell "sed -i '1iinstall.prefix = \"/opt/rustc\"' bootstrap.toml")
(shell "./x.py install")
(shell "for f in /opt/rustc/bin/*; do ln -s \"$f\" /usr/bin/ || true; done")))
(shell "for f in /opt/rustc/bin/*; do ln -sf \"$f\" /usr/bin/ || true; done")))

12
packages/tor.shrap Normal file
View File

@@ -0,0 +1,12 @@
(package
(name "tor")
(version "0.4.9.5")
(homepage "https://www.torproject.org/")
(dependencies libevent zlib zstd)
(src (tar
(url "https://dist.torproject.org/tor-0.4.9.5.tar.gz")
(dir "tor-0.4.9.5")
(blake3 "6e0e93223b4b22693207750cb850abe9e106c2b6a4e5e14b9f2012ee43fd4fab")))
(build
(configure_make
(configure_flags "--enable-lzma --enable-zstd"))))

11
packages/util-linux.shrap Normal file
View File

@@ -0,0 +1,11 @@
(package
(name "util-linux")
(version "2.41.3")
(homepage "https://www.kernel.org/pub/linux/utils/util-linux/")
(dependencies make sqlite3 pkg-config)
(src (tar
(url "https://www.kernel.org/pub/linux/utils/util-linux/v2.41/util-linux-2.41.3.tar.gz")
(dir "util-linux-2.41.3")
(blake3 "cc3729fd494203532832ee68acbedb39ed876e07c6fd7d61900f926664e859a6")))
(build
(configure_make)))

View File

@@ -35,4 +35,4 @@ public:
private:
SQLite::Database m_db{DB_PATH + "/shrap.db",
SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE};
};
};

View File

@@ -8,7 +8,7 @@
#include <thread>
#include <unordered_map>
static const std::string BUILD_PATH = "/tmp/shrap";
constexpr static const std::string BUILD_PATH = "/tmp/shrap";
std::unordered_map<std::string, Expr> packages;
@@ -216,6 +216,11 @@ void generate_graph(const std::vector<std::string> &to_highlight) {
int main(int argc, char **argv) {
auto args = std::span(argv, static_cast<size_t>(argc));
if (geteuid() != 0) {
std::cerr << "This program needs to be ran as root.\n";
return 1;
}
std::filesystem::create_directories(BUILD_PATH);
std::filesystem::create_directories(DB::DB_PATH);
@@ -239,10 +244,6 @@ int main(int argc, char **argv) {
}
}
if (!flag_raw) {
to_install = resolve_dependencies(to_install, db);
}
if (flag_graph) {
generate_graph(to_install);
return 0;
@@ -253,9 +254,8 @@ int main(int argc, char **argv) {
return 1;
}
if (geteuid() != 0) {
std::cerr << "This program needs to be ran as root.\n";
return 1;
if (!flag_raw) {
to_install = resolve_dependencies(to_install, db);
}
std::cout << "\nFollowing packages will be installed:\n";

View File

@@ -27,6 +27,7 @@ static void shell_command(const std::string &cmd,
_exit(1);
}
std::cout << cmd << std::endl;
execl("/bin/sh", "sh", "-c", cmd.c_str(), nullptr); // NOLINT(*-vararg)
perror("execl failed");
@@ -79,4 +80,4 @@ static std::string hash_file(const std::string &path) {
return ss.str();
}
}; // namespace Util
}; // namespace Util