2012-06-04 98 views
7

我已經創建了一個小型Debian軟件包,它必須從用戶那裏接受輸入並將其打印出來。如何在Debian系統上安裝Debian軟件包時讀取輸入信息

爲了從postinst腳本的用戶「讀」命令輸入腳本不能在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

有誰知道我做了什麼錯誤?

+0

我已經解決我自己的問題,我錯過了配置腳本,避免配置腳本echo語句 –

回答

1

的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 
相關問題