
私は、さまざまなパッケージを必要に応じて設定するためのbashスクリプトを作成中です。Debianの「unattended-upgrades」をインストールする場合、通常、必要なユーザー介入の1つは*user@hostname:~# dpkg-reconfigure -plow unattended-upgrades*
、/etc/apt/apt.conf.d/20自動アップグレードファイルの内容。
私は、次の文字列を使用して unattended-upgrades を設定したいと考えています (Debian Wiki の Unattended-upgrades ページから) :https://wiki.debian.org/UnattendedUpgrades
これを使用することを提案しています "または、非対話的に実行します:
echo unattended-upgrades unattended-upgrades/enable_auto_updates boolean true | debconf-set-selections dpkg-reconfigure -f noninteractive unattended-upgrades
したがって、この提案された文字列を含むスクリプトを実行すると、次のようになります。
Unknown option: f
Usage: debconf-set-selections [-vcu] [file]
-v, --verbose verbose output
-c, --checkonly only check the input file format
-u, --unseen do not set the 'seen' flag when preseeding values
言及されているエラー「f」は、Debian Wiki スクリプト文字列提案内の「-f」オプションを参照しているものと想定しています。スクリプトが完了すると、すべてが期待どおりに動作しているように見えます。「Unattended-upgrades」はユーザーの介入なしにインストールされました。
皆さんと同じように、私もさまざまな bash スクリプトを作成するときに bash の学習を続けています。そこで、初心者のスクリプト作成者としての私の質問は、Debian wiki ページで提案されている方法よりも、この unattended-upgrades の非対話型インストールをスクリプト化するより良い方法はあるでしょうか? この「f」の苦情は気にするべきでしょうか、それともエラーを無視するべきでしょうか?
答え1
残念ながら、あなたはhttps://wiki.debian.org/UnattendedUpgrades指示を実行し、両方のコマンドを 1 つに結合しました。
または、非対話的に次のコマンドを実行します。
echo unattended-upgrades unattended-upgrades/enable_auto_updates boolean true | debconf-set-selections dpkg-reconfigure -f noninteractive unattended-upgrades
(ソース:https://wiki.debian.org/UnattendedUpgrades(わかりやすくするために空白行を追加しました)
走る
echo unattended-upgrades unattended-upgrades/enable_auto_updates boolean true | debconf-set-selections
そして実行する
dpkg-reconfigure -f noninteractive unattended-upgrades
私の理解では、最初のコマンドは unattented-upgrades ファイルを設定し、2 番目のコマンドは dpkg にそのファイルを非対話型フロントエンドに使用するように指示します。