LoginSignup
0
0

pkgbuildから実行されるスクリプトで現在のユーザを取得する

Posted at

macOSでpkgインストーラを作成する際,preinstall,postinstallといったスクリプトファイルを作ることでインストール前後の処理を書くことができる.

インストールはrootユーザで行われるため,スクリプト内では logname など通常の方法でユーザ名を取得することができない.

現在のユーザ名を知りたい場合は以下のコマンドで取得することができる.

$(stat -f '%Su' $HOME)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0