窓を作っては壊していた人のブログ

この謎のブログタイトルの由来を知るものはもういないだろう

なぜか完全削除が出来なかったmacOS向けのWacomのペンタブドライバを削除する

備忘録

だいぶ昔に使っていたWacomのペンタブがあって使わないからと言ってドライバを削除した記憶がある。 が、最近macOSのアップデートを行ったら f:id:yamachu_co:20210607101640p:plain

読み込みがブロックされたという旨のダイアログが出てきて、ドライバー、消したはずでは!?となったので根こそぎ消していく。

  1. sudo find / '*wacom*' でとりあえず探す

どこにあるのか見当がつかなかったのでこれで一旦探してみます。

/System/Volumes/Data/private/var/db/receipts/com.wacom.PenTabletInstaller.plist
/System/Volumes/Data/private/var/db/receipts/com.wacom.PenTabletInstaller.bom
/private/var/db/receipts/com.wacom.PenTabletInstaller.plist
/private/var/db/receipts/com.wacom.PenTabletInstaller.bom

こんなのが見つかった。 wacomの名前でドライバが転がってるわけではなかったが、とりあえずファイル配置が書いてある .bom ファイルが見つかった。

  1. lsbom を使ってどんなファイルがインストールされたのかを見てみる

いきなり lsbom にたどり着いたわけではないんだけど、lesspipe に突っ込んだら整形されたし file コマンド叩いたら Mac OS X bill of materials (BOM) file って出てきたのでそのあたりぐぐったら lsbom が見つかった。

manには

The lsbom command interprets the contents of binary bom (bom(5)) files. For each file in a bom, lsbom prints the file path and/or requested information.

とあり、bomについて見てみると

File information includes: the file's UNIX permissions, its owner and group, its size, its time of last modification, and so on.

なるほど、インストーラーが何を突っ込んでくるかの構成表なのかってことがわかる。 ってことで使って中身を見てみる。

$ lsbom /System/Volumes/Data/private/var/db/receipts/com.wacom.PenTabletInstaller.plist

.   40755   0/0
./Applications  40755   0/0
./Applications/Pen Tablet.localized 40755   0/0
./Applications/Pen Tablet.localized/.localized  40755   0/0
./Applications/Pen Tablet.localized/.localized/de.strings   100644  0/0 184 965283972
./Applications/Pen Tablet.localized/.localized/en.strings   100644  0/0 156 4126915186
./Applications/Pen Tablet.localized/.localized/es.strings   100644  0/0 180 3855762533
./Applications/Pen Tablet.localized/.localized/fr.strings   100644  0/0 168 2428769691
./Applications/Pen Tablet.localized/.localized/it.strings   100644  0/0 156 1044215362
./Applications/Pen Tablet.localized/.localized/ja.strings   100644  0/0 152 2588287573
./Applications/Pen Tablet.localized/.localized/ko.strings   100644  0/0 132 2731968358
./Applications/Pen Tablet.localized/.localized/nl.strings   100644  0/0 180 1769518410
./Applications/Pen Tablet.localized/.localized/pl.strings   100644  0/0 164 978034193
./Applications/Pen Tablet.localized/.localized/pt.strings   100644  0/0 232 3702078223
./Applications/Pen Tablet.localized/.localized/ru.strings   100644  0/0 256 817618957
./Applications/Pen Tablet.localized/.localized/tr.strings   100644  0/0 156 4126915186
./Applications/Pen Tablet.localized/.localized/zh_CN.strings    100644  0/0 136 1004093214
./Applications/Pen Tablet.localized/.localized/zh_TW.strings    100644  0/0 148 3004780678
./Applications/Pen Tablet.localized/Pen Tablet Utility.app  40755   0/0
(省略)

こんな感じでインストール先が列挙されるので、これを整形していく。 タブ文字区切りなので、cutでdelimiterにタブ文字をセットして…

$  lsbom /System/Volumes/Data/private/var/db/receipts/com.wacom.PenTabletInstaller.bom |cut -d'   ' -f1|sed 's:^.::g'

/Applications/Pen Tablet.localized
/Applications/Pen Tablet.localized/.localized
/Applications/Pen Tablet.localized/.localized/de.strings
/Applications/Pen Tablet.localized/.localized/en.strings
/Applications/Pen Tablet.localized/.localized/es.strings
/Applications/Pen Tablet.localized/.localized/fr.strings
/Applications/Pen Tablet.localized/.localized/it.strings
/Applications/Pen Tablet.localized/.localized/ja.strings
/Applications/Pen Tablet.localized/.localized/ko.strings
/Applications/Pen Tablet.localized/.localized/nl.strings
/Applications/Pen Tablet.localized/.localized/pl.strings
/Applications/Pen Tablet.localized/.localized/pt.strings
/Applications/Pen Tablet.localized/.localized/ru.strings
/Applications/Pen Tablet.localized/.localized/tr.strings
/Applications/Pen Tablet.localized/.localized/zh_CN.strings
/Applications/Pen Tablet.localized/.localized/zh_TW.strings
/Applications/Pen Tablet.localized/Pen Tablet Utility.app
(省略)

こんな感じの出力が出るように。

あとはこいつらでlsして残っているファイルを探していく。

ここで勢い余って rm なんてしないように!!! 普通にトップレベルのディレクトリも存在しているので、その中の対象のファイルだけを消しましょう。

これらを xargs で見ていったら

/Library/Extensions/SiLabsUSBDriver64.kext

こいつが残っていた。

  1. 消す

消せばいいんだけど、日和ったので一旦別ディレクトリに動かした。 とりあえずこれでキレイになっただろう。

今後完全削除したいなと思ったら lsbom を使おうと思う。

Durable FunctionsがmacOSでもローカルでEmulatorのAzuriteを使って開発できるようになってた

つい最近AzuriteにTable ServiceのPreviewが追加されたようです。

github.com

これが何を意味するかと言うと、Durable FunctionsのOrchestration関数の開始や停止などのアクションが格納、処理できるようになったため、AzuriteをバックエンドにDurable Functionsでアプリケーションを開発できるようになったってことですヤッター!

今までは例えばmacOSでDurable Functionsを使った開発をする場合は、 local.setting.json に有効なStorage Accountの接続情報を記述して、アプリケーションは手元で、各アクションの履歴はAzure上のTableにみたいな流れにすれば開発は出来ていました。 それがこれからはAzuriteをローカルで動かして、接続情報をローカルに向けるだけで開発が出来るようになります。

今まで出来なかったよねの話やIssueの話は

k-miyake.github.io

こちらの記事を見てみると良いです。

試してみる

まずは現状把握として Azure Storage Explorer でローカルに何も立っていない、アクセス出来ないよねを確認してみます。

f:id:yamachu_co:20210526174226p:plain
Docker起動前のStorageAccountの様子

Listには載っていますが、クリックしても接続エラーが出るだけです。

ということでAzure Storage Explorerから手元が見えるようにAzuriteを起動してみます。 AzuriteはnpmやDockerHub、GitHubなどで提供されています。 今回はDockerHubで提供されているlatestを使って試してみます。

$ docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite
Azurite Blob service is starting at http://0.0.0.0:10000
Azurite Blob service is successfully listening at http://0.0.0.0:10000
Azurite Queue service is starting at http://0.0.0.0:10001
Azurite Queue service is successfully listening at http://0.0.0.0:10001
Azurite Table service is starting at http://0.0.0.0:10002
Azurite Table service is successfully listening at http://0.0.0.0:10002

こんな感じで立ち上げたら10002番ポートでTable Serviceが立ち上がってるみたいですね。

この状態でAzure Storage ExplorerでRefresh Allしてみると接続出来るのが確認できると思います。 接続が確認できたら手元で適当にDurable Functionsのアプリケーションを立ててみましょう。

とりあえず手っ取り早く動かしたいので以下の物を作りました

  1. func new で JavaScript のアプリケーションを作る
  2. npm i durable-functions でDurable Functions動かせるようにしておく
  3. func new で Durable Functions orchestrator, Durable Functions activity, Durable Functions HTTP starterの3つを作る

これで最低限動くものが出来ましたが、このステップの他に必要なことがあります。 この記事の先頭で言及していた local.settings.json の書き換えです。

ローカルに接続するための接続情報を記述する必要があるので、以下のように設定します。

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "node",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true"
  }
}

詳しい接続文字列についてはDocsを参照してください。

ローカルでの Azure Storage の開発に Azurite エミュレーターを使用する | Microsoft Docs

この状態でスタートをしてみると

$ func start

Azure Functions Core Tools
Core Tools Version:       3.0.3477 Commit hash: 5fbb9a76fc00e4168f2cc90d6ff0afe5373afc6d  (64-bit)
Function Runtime Version: 3.0.15584.0

[2021-05-26T09:15:12.228Z] Cannot create directory for shared memory usage: /dev/shm/AzureFunctions
[2021-05-26T09:15:12.229Z] System.IO.FileSystem: Access to the path '/dev/shm/AzureFunctions' is denied. Operation not permitted.

Functions:

    DurableFunctionsHttpStart: [POST,GET] http://localhost:7071/api/orchestrators/{functionName}

    DurableFunctionsOrchestratorJS: orchestrationTrigger

    Hello: activityTrigger

待受が始まるので、HttpTriggerからOrchestratorを呼び出してみます。

$ curl http://localhost:7071/api/orchestrators/DurableFunctionsOrchestratorJS

では返ったきたStatusGetのURLを見てみましょう

$ curl http://localhost:7071/api/orchestrators/DurableFunctionsOrchestratorJS
{
  "id": "fcd4eb831b964f278f621807ebffff21",
  "statusQueryGetUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/fcd4eb831b964f278f621807ebffff21?taskHub=TestHubName&connection=Storage&code=6/k4Nwo5z8gCWp9fygP2WPAiM78w9BgmzMvxEHZa4C3CnhdXVkW2fA==",
  "sendEventPostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/fcd4eb831b964f278f621807ebffff21/raiseEvent/{eventName}?taskHub=TestHubName&connection=Storage&code=6/k4Nwo5z8gCWp9fygP2WPAiM78w9BgmzMvxEHZa4C3CnhdXVkW2fA==",
  "terminatePostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/fcd4eb831b964f278f621807ebffff21/terminate?reason={text}&taskHub=TestHubName&connection=Storage&code=6/k4Nwo5z8gCWp9fygP2WPAiM78w9BgmzMvxEHZa4C3CnhdXVkW2fA==",
  "rewindPostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/fcd4eb831b964f278f621807ebffff21/rewind?reason={text}&taskHub=TestHubName&connection=Storage&code=6/k4Nwo5z8gCWp9fygP2WPAiM78w9BgmzMvxEHZa4C3CnhdXVkW2fA==",
  "purgeHistoryDeleteUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/fcd4eb831b964f278f621807ebffff21?taskHub=TestHubName&connection=Storage&code=6/k4Nwo5z8gCWp9fygP2WPAiM78w9BgmzMvxEHZa4C3CnhdXVkW2fA=="
}%
#
$ curl "http://localhost:7071/runtime/webhooks/durabletask/instances/fcd4eb831b964f278f621807ebffff21?taskHub=TestHubName&connection=Storage&code=6/k4Nwo5z8gCWp9fygP2WPAiM78w9BgmzMvxEHZa4C3CnhdXVkW2fA=="
{"name":"DurableFunctionsOrchestratorJS","instanceId":"fcd4eb831b964f278f621807ebffff21","runtimeStatus":"Completed","input":null,"customStatus":null,"output":["Hello Tokyo!","Hello Seattle!","Hello London!"],"createdTime":"2021-05-26T09:23:44Z","lastUpdatedTime":"2021-05-26T09:23:44Z"}%

動作が確認できました。

またAzure Storage Explorerを確かめてみると

f:id:yamachu_co:20210526182643p:plain
Orchestration関数を実行した後の様子

Dockerに立てたEmulatorが使われていることが確認できました、素晴らしい。

この様にAzuriteのアップデートによりmacOSでもローカル環境でDurable Functionsのストレス無い開発が出来るようになりました。 Dev環境として一個アカウントを払い出すのが面倒…けれども自分のマシンはmacだし…みたいな悩みを抱えていた人にとっては素晴らしいアップデートだと感じています。