aboutsummaryrefslogblamecommitdiffstats
path: root/unmaintained/cfengine/alpinelinux.patch
blob: 40c95aa412dcce34e0e3a90449442a4d7842cdcb (plain) (tree)







































































                                                                                                       
diff --git a/masterfiles/libraries/cfengine_stdlib.cf b/masterfiles/libraries/cfengine_stdlib.cf
index 13d554f..24529e8 100644
--- a/masterfiles/libraries/cfengine_stdlib.cf
+++ b/masterfiles/libraries/cfengine_stdlib.cf
@@ -2047,6 +2047,31 @@ package_update_command => "/usr/bin/pacman -S --noconfirm --noprogressbar --need
 
 ##
 
+body package_method alpinelinux
+{
+ package_changes => "individual";
+
+ package_list_command => "/sbin/apk info -v";
+
+ # Remember to escape special characters like |
+
+ package_list_name_regex    => "([^\s]+)-.*";
+ package_list_version_regex => "[^\s]+-([^\s]+).*";
+
+ package_name_regex    => "([^\s]+)-.*";
+ package_version_regex => "[^\s]+-([^\s]+).*";
+
+ package_installed_regex => ".*";
+
+ package_name_convention => "$(name)-$(version)";
+
+
+ package_add_command => "/sbin/apk add";
+ package_delete_command => "/sbin/apk del";
+}
+
+##
+
  # Single bundle for all the similar managers simplifies promises
 
 body package_method generic
@@ -2186,6 +2211,18 @@ archlinux::
  package_add_command => "/usr/bin/pacman -S --noconfirm --noprogressbar --needed";
  package_delete_command => "/usr/bin/pacman -Rs --noconfirm";
  package_update_command => "/usr/bin/pacman -S --noconfirm --noprogressbar --needed";
+
+alpinelinux::
+ package_changes => "individual";
+ package_list_command => "/sbin/apk info -v";
+ package_list_name_regex    => "([^\s]+)-.*";
+ package_list_version_regex => "[^\s]+-([^\s]+).*";
+ package_name_regex    => "([^\s]+)-.*";
+ package_version_regex => "[^\s]+-([^\s]+).*";
+ package_installed_regex => ".*";
+ package_name_convention => "$(name)-$(version)";
+ package_add_command => "/sbin/apk add";
+ package_delete_command => "/sbin/apk del";
 }
 
 ##
diff --git a/src/sysinfo.c b/src/sysinfo.c
index 557f449..56046ba 100644
--- a/src/sysinfo.c
+++ b/src/sysinfo.c
@@ -819,6 +819,12 @@ void OSClasses(void)
         SetFlavour("UnitedLinux");
     }
 
+    if (cfstat("/etc/alpine-release", &statbuf) != -1)
+    {
+        CfOut(cf_verbose, "", "This appears to be an AlpineLinux system.\n");
+        SetFlavour("alpinelinux");
+    }
+
     if (cfstat("/etc/gentoo-release", &statbuf) != -1)
     {
         CfOut(cf_verbose, "", "This appears to be a gentoo system.\n");