Commit cc31ea8a authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Initial commit

parents
all:
tar xf supermin-5.2.0.tar.gz
patch -Np1 -d supermin-5.2.0 < supermin-5.2.0-certo.patch
cd supermin-5.2.0 && ./configure --prefix=/usr
$(MAKE) -C supermin-5.2.0
$(MAKE) -C supermin-5.2.0 check
$(MAKE) -C supermin-5.2.0 install
rm -rf supermin-5.2.0
diff -uNr supermin-5.2.0.original/src/.depend supermin-5.2.0-certo/src/.depend
--- supermin-5.2.0.original/src/.depend 2020-03-10 10:28:53.000000000 +0000
+++ supermin-5.2.0-certo/src/.depend 2020-04-15 09:31:34.000000000 +0000
@@ -48,6 +48,9 @@
./ph_rpm.cmi :
./ph_rpm.cmo : utils.cmi package_handler.cmi os_release.cmi librpm.cmi config.cmo ./ph_rpm.cmi
./ph_rpm.cmx : utils.cmx package_handler.cmx os_release.cmx librpm.cmx config.cmx ./ph_rpm.cmi
+./ph_pkg.cmi :
+./ph_pkg.cmo : utils.cmi package_handler.cmi os_release.cmi config.cmo ./ph_pkg.cmi
+./ph_pkg.cmx : utils.cmx package_handler.cmx os_release.cmx config.cmx ./ph_pkg.cmi
./realpath.cmi :
./realpath.cmo : ./realpath.cmi
./realpath.cmx : ./realpath.cmi
diff -uNr supermin-5.2.0.original/src/Makefile.am supermin-5.2.0-certo/src/Makefile.am
--- supermin-5.2.0.original/src/Makefile.am 2017-08-24 12:28:08.000000000 +0000
+++ supermin-5.2.0-certo/src/Makefile.am 2020-04-15 09:31:34.000000000 +0000
@@ -54,6 +54,8 @@
ph_dpkg.mli \
ph_pacman.ml \
ph_pacman.mli \
+ ph_pkg.ml \
+ ph_pkg.mli \
mode_prepare.ml \
mode_prepare.mli \
format_chroot.ml \
@@ -86,6 +88,7 @@
ph_rpm.ml \
ph_dpkg.ml \
ph_pacman.ml \
+ ph_pkg.ml \
mode_prepare.ml \
format_chroot.ml \
format_ext2_init.ml \
diff -uNr supermin-5.2.0.original/src/Makefile.in supermin-5.2.0-certo/src/Makefile.in
--- supermin-5.2.0.original/src/Makefile.in 2020-03-10 10:28:40.000000000 +0000
+++ supermin-5.2.0-certo/src/Makefile.in 2020-04-15 09:31:34.000000000 +0000
@@ -1008,6 +1008,8 @@
ph_dpkg.mli \
ph_pacman.ml \
ph_pacman.mli \
+ ph_pkg.ml \
+ ph_pkg.mli \
mode_prepare.ml \
mode_prepare.mli \
format_chroot.ml \
@@ -1041,6 +1043,7 @@
ph_rpm.ml \
ph_dpkg.ml \
ph_pacman.ml \
+ ph_pkg.ml \
mode_prepare.ml \
format_chroot.ml \
format_ext2_init.ml \
diff -uNr supermin-5.2.0.original/src/ph_pkg.ml supermin-5.2.0-certo/src/ph_pkg.ml
--- supermin-5.2.0.original/src/ph_pkg.ml 1970-01-01 00:00:00.000000000 +0000
+++ supermin-5.2.0-certo/src/ph_pkg.ml 2020-04-17 10:06:32.000000000 +0000
@@ -0,0 +1,109 @@
+(* supermin 5
+ * Copyright (C) 2009-2014 Red Hat Inc.
+ *
+ * This program 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *)
+
+open Unix
+open Printf
+
+open Utils
+open Package_handler
+
+let pkg_detect () =
+ try (stat "/usr/share/packages").st_kind = S_DIR with Unix_error _ -> false
+
+type dpkg_t = {
+ name : string;
+}
+
+(* Memo from package type to internal dpkg_t. *)
+let dpkg_of_pkg, pkg_of_dpkg = get_memo_functions ()
+
+let dpkg_packages = Hashtbl.create 13
+let pkg_package_of_string str =
+ if Hashtbl.length dpkg_packages == 0 then (
+ let cmd = sprintf "/usr/sbin/pkglist" in
+ let lines = run_command_get_lines cmd in
+ List.iter (
+ fun line ->
+ match string_split " " line with
+ | [ name ] ->
+ let dpkg = { name = name } in
+ Hashtbl.add dpkg_packages name dpkg
+ | _ -> ();
+ ) lines
+ );
+ let candidates = Hashtbl.find_all dpkg_packages str in
+ (* On multiarch setups, only consider the primary architecture *)
+ try
+ let pkg = List.find (
+ fun cand ->
+ cand.name = str
+ ) candidates in
+ Some (pkg_of_dpkg pkg)
+ with
+ Not_found -> None
+
+let pkg_package_to_string pkg =
+ let dpkg = dpkg_of_pkg pkg in
+ sprintf "%s" dpkg.name
+
+let pkg_package_name pkg =
+ let dpkg = dpkg_of_pkg pkg in
+ dpkg.name
+
+let pkg_package_index_name pkg =
+ sprintf "/usr/share/packages/%s.md5" (pkg_package_name pkg)
+
+let pkg_get_package_database_mtime () =
+ 0.0
+
+let pkg_get_all_requires pkgs =
+ pkgs
+
+let pkg_get_all_files pkgs =
+ let cmd =
+ sprintf "cat %s | awk '{ print $2 }' | grep '^/' | grep -v '^/.$' | sort -u"
+ (quoted_list (List.map pkg_package_index_name (PackageSet.elements pkgs))) in
+ let lines = run_command_get_lines cmd in
+ List.map (
+ fun path ->
+ let config =
+ try string_prefix "/etc/" path && (lstat path).st_kind = S_REG
+ with Unix_error _ -> false in
+ { ft_path = path; ft_source_path = path; ft_config = config }
+ ) lines
+
+let pkg_download_package pkg dir =
+ let cmd =
+ sprintf "cat %s | awk '{ print $2 }' | xargs cp --parents -t %s"
+ ( pkg_package_index_name pkg ) dir in
+ run_command cmd
+
+let () =
+ let ph = {
+ ph_detect = pkg_detect;
+ ph_init = (fun s -> ());
+ ph_fini = (fun () -> ());
+ ph_package_of_string = pkg_package_of_string;
+ ph_package_to_string = pkg_package_to_string;
+ ph_package_name = pkg_package_name;
+ ph_get_package_database_mtime = pkg_get_package_database_mtime;
+ ph_get_requires = PHGetAllRequires pkg_get_all_requires;
+ ph_get_files = PHGetAllFiles pkg_get_all_files;
+ ph_download_package = PHDownloadPackage pkg_download_package;
+ } in
+ register_package_handler "certo" "pkg" ph
diff -uNr supermin-5.2.0.original/src/ph_pkg.mli supermin-5.2.0-certo/src/ph_pkg.mli
--- supermin-5.2.0.original/src/ph_pkg.mli 1970-01-01 00:00:00.000000000 +0000
+++ supermin-5.2.0-certo/src/ph_pkg.mli 2020-04-15 09:31:34.000000000 +0000
@@ -0,0 +1,22 @@
+(* supermin 5
+ * Copyright (C) 2009-2016 Red Hat Inc.
+ *
+ * This program 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *)
+
+(** pkg package handler
+
+ Nothing is exported. This module registers callbacks when it
+ is loaded. *)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment