簡體   English   中英

如何在Debian系統上安裝Debian軟件包時讀取輸入

[英]How to read input while installing Debian package on Debian systems

我創建了一個小的Debian軟件包,它必須從用戶那里獲取輸入並打印出來。

為了在postinst腳本上從用戶“read”命令獲取輸入將無法在Debian系統上運行我不知道究竟是什么原因,但它在Ubuntu系統中有效。

后來我發現我們必須使用模板文件為Debian系統使用“debconf”。

模板文件:

Template: test/input
Type: text
Description: enter some text, which will be displayed

postinst腳本:

 db_get test/input
    echo "you have entered ::$RET" >&2

但是,當我安裝我的測試包時,我收到此錯誤:

Can't exec "postinst": No such file or directory at /usr/share/perl/5.10/IPC/Open3.pm line 168. <br>open2: exec of postinst configure failed at /usr/share/perl5/Debconf/ConfModule.pm line 59

有誰知道我做錯了什么?

您的postinst腳本應如下所示:

#!/bin/bash

set -e

. /usr/share/debconf/confmodule

case "$1" in
  configure)
    db_get test/input
    echo "you have entered ::$RET" >&2
  ;;
esac
db_stop

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM