2019/04/16

SoftwareUpdate設定をCLIで(Mojave)


Mojave(macOS 10.14)でソフトウエアアップデートの設定メモ
設定は以下の2ファイル...(0:OFF/1:ON)

/Library/Preferences/com.apple.SoftwareUpdate.plist
/Library/Preferences/com.apple.commerce.plist


ちなみにインストール済みのリストは以下に記載
/Library/Receipts/InstallHistory.plist
インストーラのbom,plistファイル等はにある
/private/var/db/receipts/*
..ので見るならlsbomやplutilで..

Pkgファイルでインストールしたものは
$ pkgutil --pkgs | --pkg-info | --files
あたりでも..



ref.
$ defaults read /Library/Preferences/com.apple.SoftwareUpdate.plist
{
    AutomaticCheckEnabled = 0;
    AutomaticDownload = 0;
    AutomaticallyInstallMacOSUpdates = 0;
    ConfigDataInstall = 0;
    CriticalUpdateInstall = 0;
    LastAttemptBuildVersion = "10.14.2 (18C54)";
    LastAttemptSystemVersion = "10.14.2 (18C54)";
    LastFullSuccessfulDate = "2019-04-16 08:14:01 +0000";
    LastRecommendedUpdatesAvailable = 1;
    LastResultCode = 0;
    LastSuccessfulDate = "2019-04-16 08:14:01 +0000";
    LastUpdatesAvailable = 1;
    PrimaryLanguages =     (
        "ja-JP",
        ja
    );
    RecommendedUpdates =     (
                {
            "Display Name" = "macOS 10.14.4\\U30a2\\U30c3\\U30d7\\U30c7\\U30fc\\U30c8";
            "Display Version" = " ";
            Identifier = "macOS 10.14.4 Update";
            "Product Key" = "041-49226";
        }
    );
}
$
$
$ defaults read /Library/Preferences/com.apple.commerce.plist
{
    AutoUpdate = 0;
}
$
$
$ plutil -p /Library/Receipts/InstallHistory.plist
[
  0 => {
    "date" => 2018-05-25 09:05:09 +0000
    "displayName" => "SU_TITLE"
    "displayVersion" => ""
    "packageIdentifiers" => [
      0 => "com.apple.pkg.Core"
      1 => "com.apple.pkg.EmbeddedOSFirmware"
      2 => "com.apple.pkg.BridgeOSUpdateCustomer"
      3 => "com.apple.pkg.BridgeOSBrain"
    ]
    "processName" => "macOS Installer"
  }
  1 => {
    "contentType" => "config-data"
    "date" => 2018-05-25 09:26:57 +0000
    "displayName" => "XProtectPlistConfigData"
    "displayVersion" => "2099"
    "packageIdentifiers" => [
      0 => "com.apple.pkg.XProtectPlistConfigData.16U4033"
    ]
    "processName" => "softwareupdated"
  }
.....
.....
.....
]
$
$
$ ls -lt /private/var/db/receipts
total 239824
-rw-r--r--  1 root  wheel       295  4 16 16:12 com.microsoft.package.Microsoft_PowerPoint.app.plist
-rw-r--r--  1 root  wheel    348923  4 16 16:12 com.microsoft.package.Microsoft_PowerPoint.app.bom
-rw-r--r--  1 root  wheel       283  4 16 16:12 com.microsoft.package.Microsoft_Word.app.plist
-rw-r--r--  1 root  wheel    454003  4 16 16:12 com.microsoft.package.Microsoft_Word.app.bom
-rw-r--r--  1 root  wheel       285  4 16 16:10 com.microsoft.package.Microsoft_Excel.app.plist
-rw-r--r--  1 root  wheel    511875  4 16 16:10 com.microsoft.package.Microsoft_Excel.app.bom
.....
.....
.....
$
$ plutil -p /private/var/db/receipts/com.microsoft.package.Microsoft_PowerPoint.app.plist
{
  "InstallDate" => 2019-04-16 07:12:58 +0000
  "InstallPrefixPath" => "Applications"
  "InstallProcessName" => "installer"
  "PackageFileName" => "Microsoft_PowerPoint.pkg"
  "PackageIdentifier" => "com.microsoft.package.Microsoft_PowerPoint.app"
  "PackageVersion" => "16.24.19041401"
}
$
$ lsbom /private/var/db/receipts/com.microsoft.package.Microsoft_PowerPoint.app.bom
.       40755   0/0
./Microsoft PowerPoint.app      40755   0/0
./Microsoft PowerPoint.app/Contents     40755   0/0
./Microsoft PowerPoint.app/Contents/Frameworks  40755   0/0
./Microsoft PowerPoint.app/Contents/Frameworks/ADAL.framework   40755   0/0
.....
.....
.....
$
$
$ pkgutil --pkgs
com.apple.pkg.DevSDK_macOS1013_Public
com.apple.pkg.iTunesX.12.7.5.patch
com.apple.pkg.GatekeeperConfigData.16U1672
com.apple.pkg.GatekeeperConfigData.16U1699
com.apple.update.fullbundleupdate.18D109
.....
.....
.....
$
$ pkgutil --info com.apple.pkg.iTunesX.12.7.5.patch
package-id: com.apple.pkg.iTunesX.12.7.5.patch
version: 12.7.5.0.1.1527064546
volume: /
location: /
install-time: 1527682440
groups: com.apple.findsystemfiles
$
$ pkgutil --files com.apple.pkg.iTunesX.12.7.5.patch
Applications
Applications/iTunes.app
Applications/iTunes.app/Contents
Applications/iTunes.app/Contents/Frameworks
.....
.....
.....


-----
OSのアップデートは softwareupdate(8) でやるとして,Mac App Store分のアップデートはmas-cliでやる(か?自動アップデートに任せるか?)しかないのかなぁ...<教えて偉い人^^/

-mas https://github.com/mas-cli/mas

以上.