2012年7月11日水曜日

Ubuntu 12.04のログイン画面(LightDM)から電源系のボタンを取り除く

Ubuntu 12.04のLightDMのログイン画面からシャットダウン、再起動のボタンを消したい事情が発生したので、検索かけてたら、あたったので翻訳。
http://askubuntu.com/questions/137336/how-do-i-remove-the-shutdown-button-only-on-the-login-screen

原文
Even if you cannot hide the buttons, you can configure your system so that the lightdm user does not have permissions to shutdown or restart the system. Since the greeter runs as the lightdm user, this should solve your issue. Create two new files in /var/lib/polkit-1/localauthority/50-local.d, call them disable-lightdm-shutdown.pkla and disable-lightdm-restart.pkla and apply the contents as below. Note: You can also stick these into one file.

Shutdown:
[Disable Shutdown]
Identity=unix-user:lightdm
Action=org.freedesktop.consolekit.system.stop
ResultAny=no
ResultInactive=no
ResultActive=no

Restart:
[Disable Restart]
Identity=unix-user:lightdm
Action=org.freedesktop.consolekit.system.restart
ResultAny=no
ResultInactive=no
ResultActive=no
訳文
それらのボタンを隠せなかったとしても、lightdm ユーザーにシャットダウン・リブートの権限を与えないようにシステムを設定することが可能である。greeter[多分ログイン画面のこと]はlightdm ユーザーで動いているので、これで問題は解決するはずだ。
/var/lib/polkit-1/localauthority/50-local.dの中に、2つのファイル、disable-lightdm-shutdown.pklaとdisable-lightdm-restart.pklaとを作り、中身は以下のようにする。
1つのファイルにしてもいける。
[以下略]
なるほどねー。ログイン画面はlightdmユーザーとして起動してるのかぁ。ってそりゃそうか。

2012年7月7日土曜日

UTF-8なtexファイルをEUCなplatexを通してコンパイルするMakefile

なんか、Twitterの方で、ぜひ教えて欲しい的な声が上がったので、ちょっと恥ずかしいけどあげときますね。
初期版
#Makefile
F=report
$F.pdf:$F.euc.dvi
    dvipdfmx -o $F.pdf $F.euc.dvi
$F.euc.dvi:$F.euc.tex
    platex --kanji=euc $F.euc.tex
$F.euc.tex:$F.tex
    nkf -e $F.tex >$F.euc.tex
clean:
    rm $F.euc.dvi $F.pdf $F.euc.log $F.euc.aux $F.euc.tex

12.07.07改訂版
#Makefile
F=report
$F.pdf:$F.dvi
     dvipdfmx -o $F.pdf $F.dvi
$F.dvi:$F.euc.tex
     platex --kanji=euc $F.euc.tex
     mv $F.euc.dvi $F.dvi
$F.euc.tex:$F.tex
     nkf -e $F.tex >$F.euc.tex
clean:
     rm $F.dvi $F.pdf $F.euc.log $F.euc.aux $F.euc.tex
使い方(改訂版)
  • スペースでインデントしてあるところはタブのインデントに置き換えてね。
  • 対象のtexファイルと同じディレクトリに`Makefile'として設置します。
  • あとは $ make としたらreport.dvi/report.pdfが生成されます。
  • $ make clean で生成ファイル、一時ファイルが削除されます。
  • texファイルの中身は生成してくれません。頑張って書いてください。
一応、説明(改訂版)
  • F=reportの部分は、texファイル名の本体部です。必要に応じて変えてください。
  • nkfで、UTF-8なtexファイルのreport.texをEUCなtex一時ファイルのreport.euc.texを生成。
  • 生成されたreport.euc.texをEUCな感じでplatexに通して、report.dviを生成。
  • dvipdfmxでreport.dviからreport.pdfを生成します。
  • "(ひだり):(みぎ)"の部分は、(ひだり)が(みぎ)に依存してるってことだったと思います。