Merge branch 'patch/intune' into 'master'

Draft: Add Microsoft Intune agent

See merge request nonguix/nonguix!184
This commit is contained in:
Petr Hodina 2025-02-16 10:31:49 +00:00
commit cb18a83a72

225
nongnu/packages/intune.scm Normal file
View File

@ -0,0 +1,225 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Petr Hodina <phodina@protonmail.com>
;;;
;;; This file is not part of GNU Guix.
;;;
;;; 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 3 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, see <https://www.gnu.org/licenses/>.
(define-module (nongnu packages intune)
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (gnu packages)
#:use-module (gnu packages admin)
#:use-module (gnu packages build-tools)
#:use-module (gnu packages base)
#:use-module (gnu packages ninja)
#:use-module (gnu packages curl)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gtk)
#:use-module (gnu packages glib)
#:use-module (gnu packages linux)
#:use-module (gnu packages tls)
#:use-module (gnu packages gcc)
#:use-module (gnu packages compression)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages webkit)
#:use-module (gnu packages xorg)
#:use-module (gnu packages pkg-config)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (nonguix build-system binary)
#:use-module (guix build-system cmake)
#:use-module ((guix licenses)
#:prefix license:))
(define-public intune
(package
(name "intune")
(version "1.2211.21")
(source (origin
(method url-fetch)
(uri (string-append
"https://packages.microsoft.com/ubuntu/20.04/prod/pool/main/i/intune-portal/intune-portal_"
version "_amd64.deb"))
(sha256
(base32
"1m3d0f0x27c4ahv2h0035yw3ihcihw2r31h0in8r34r45nmq2r39"))))
(build-system binary-build-system)
(arguments
(list #:patchelf-plan #~`(("opt/microsoft/intune/bin/intune-agent" ("atk"
"libx11"
"libsecret"
"openssl"
"libsoup-minimal"
"util-linux"
"gtk+"
"glibc"
"zlib"
"inetutils"
"sqlite"
"curl"
"libstdc++"
"gcc"
"webkitgtk-with-libsoup2"
"glib"))
("opt/microsoft/intune/bin/intune-portal" ("atk"
"libx11"
"libsecret"
"libsoup-minimal"
"openssl"
"util-linux"
"glibc"
"gtk+"
"zlib"
"sqlite"
"inetutils"
"pango"
"curl"
"libstdc++"
"gcc"
"webkitgtk-with-libsoup2"
"glib")))
#:install-plan #~`(("opt/microsoft/intune/bin" "bin"))
#:phases #~(modify-phases %standard-phases
(delete 'validate-runpath)
(replace 'unpack
(lambda* (#:key inputs #:allow-other-keys)
(let ((debian-files (assoc-ref inputs "source")))
(invoke "ar" "x" debian-files)
(invoke "tar" "xJf" "data.tar.xz")))))))
(inputs (list atk
libx11
curl
;; msalsdk-dbusclient
libsecret
libsoup-minimal-2
glibc
openssl
(make-libstdc++ gcc)
inetutils ;for hostname
`(,util-linux "lib")
webkitgtk-with-libsoup2
`(,gcc "lib")
pango
gtk+
sqlite
;; systemd
zlib
glib))
(synopsis "Microsoft Intune Endpoint Agent")
(description "This package provides Microsoft Endpoint Manager to protect
organization-owned data on devices.")
(home-page
"https://docs.microsoft.com/en-us/mem/intune/fundamentals/what-is-intune")
;; Well what to do
;; https://docs.microsoft.com/en-us/mem/intune/fundamentals/licenses
(license #f)))
(define-public msalsdk-dbusclient
(package
(name "msalsdk-dbusclient")
(version "1.0.0")
(source (origin
(method url-fetch)
(uri (string-append
"https://packages.microsoft.com/ubuntu/20.04/prod/pool/main/m/msalsdk-dbusclient/msalsdk-dbusclient_"
version "_amd64.deb"))
(sha256
(base32
"0dhbmwrkqg3swd3y8f6r5xrnvrzc1vkpc10sdw4z6fwx0cbqsn3q"))))
(build-system binary-build-system)
(arguments
(list #:patchelf-plan #~`(("usr/lib/libmsal_dbus_client.so" ("glibc"
"dbus"
"libstdc++"
"gcc")))
;; #:install-plan
;; #~`(("usr/bin" "bin"))
#:phases #~(modify-phases %standard-phases
(replace 'unpack
(lambda* (#:key inputs #:allow-other-keys)
(let ((debian-files (assoc-ref inputs "source")))
(invoke "ar" "x" debian-files)
(invoke "tar" "xzf" "data.tar.gz")))))))
(inputs (list dbus glibc
(make-libstdc++ gcc)
`(,gcc "lib")
;; sdbus-cpp
))
(synopsis "Microsoft Authentication Library cross platform")
(description "")
(home-page "")
;; Well what to do
;; https://docs.microsoft.com/en-us/mem/intune/fundamentals/licenses
(license #f)))
(define-public sdbus-cpp
(package
(name "sdbus-cpp")
(version "1.1.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/Kistler-Group/sdbus-cpp")
(recursive? #t)
(commit (string-append "v" version))))
;; (patches '("patches/sdbus-cpp-remove-systemd.patch"))
(sha256
(base32
;; "1d1fdk47j36mvnmp9lnypj9cfmfkxm3hc507iis775lci7lrjdh2"))))
"1d1fdk47j36mvnmp9lnypj9cfmfkxm3hc507iis775lci7lrjdh2"))))
(build-system cmake-build-system)
(arguments
(list #:configure-flags #~(list "-DBUILD_LIBSYSTEMD=ON"
"-DBUILD_TESTS=ON")
#:phases #~(modify-phases %standard-phases
(add-after 'unpack 'fix-mount-package
(lambda* _
(substitute* "cmake/LibsystemdExternalProject.cmake"
(("MOUNT mount")
"UTIL-LINUX util-linux")))))))
(native-inputs (list meson ninja pkg-config))
(inputs (list dbus util-linux libcap))
(home-page "https://github.com/Kistler-Group/sdbus-cpp")
(synopsis "High-level C++ D-Bus library")
(description "")
(license license:lgpl2.1)))
; TODO: JAVA based
(define-public msft-identity-broker
(package
(name "msft-identity-broker")
(version "1.0.6")
(source (origin
(method url-fetch)
(uri (string-append
"https://packages.microsoft.com/ubuntu/20.04/prod/pool/main/m/msft-identity-broker/msft-identity-broker_"
version "_amd64.deb"))
(sha256
(base32
"1frbqsvsz74w1sms2sdbn402b2aabp4v354g4qs2nl0agcnvw8sm"))))
(build-system binary-build-system)
(arguments
(list #:phases #~(modify-phases %standard-phases
(replace 'unpack
(lambda* (#:key inputs #:allow-other-keys)
(let ((debian-files (assoc-ref inputs "source")))
(invoke "ar" "x" debian-files)
(invoke "tar" "xzf" "data.tar.gz")))))))
(synopsis "Microsoft Identity broker")
(description "")
(home-page "")
;; Well what to do
;; https://docs.microsoft.com/en-us/mem/intune/fundamentals/licenses
(license #f)))