#!/bin/sh
set -e

. /usr/share/debconf/confmodule

# 先在 /etc/hosts 查找，是否已经有 apt-proxy 主机记录 IP 地址
OIP=`grep -v ^# /etc/hosts|grep apt-proxy|tail -n 1|awk {'print $1'}`

# 如果有，则设置为 debconf 预设默认值
if [ $OIP ];then
	db_set apt-cacher-ng-client/apt-proxy-ip $OIP
fi

# 提示用户输入 IP 地址，会默认从 debconf 里面预设值里面取值
db_input high apt-cacher-ng-client/apt-proxy-ip || true

db_go

#DEBHELPER#
