5 read -e -n 1 -p "$prompt" reply
18 # diskusage <path>: prints size in MB
21 read size dummy < <( du -sm --apparent-size "$path" )
26 # diskfree <minimum size in MB>
29 echo -n "Checking free diskspace:"
30 (( free = `stat -f -c '%a / 2048 * ( %s / 512 )' $tmp ` ))
32 if [ "$free" -ge "$size" ]; then
38 WARNING: Possibly not enough free disk space in "$tmp".
40 You need at least $size MB, but only $free MB seems free. Note: You
41 can specify an alternate directory by setting the environment variable
43 Press Ctrl+C to interrupt, or return to try to continue anyway.
53 # extract_bin <file> <expected_min_size> <dest>
56 local expected_min_size="$2"
60 In the next step, the binary file will be extracted. Probably a
61 license agreement will be displayed. Please read this agreement
62 carefully. If you do not agree to the displayed license terms, the
63 package will not be built.
66 read -e -p "Press [Return] to continue: " dummy
68 local extract_dir="$tmp/extract"
74 case "$archive_path" in
76 extract_cmd="tar xf";;
78 extract_cmd="tar --bzip2 -xf";;
80 extract_cmd="tar xfz";;
82 extract_cmd="unzip -q";;
87 if ! $extract_cmd "$archive_path"; then
90 WARNING: The package installation script exited with an error
91 value. Usually, this means, that the installation failed for some
92 reason. But in some cases there is no problem and you can continue
93 creating the Debian package.
95 Please check if there are any error messages. Press [Return] to
96 continue or Ctrl-C to abort.
102 echo -n "Testing extracted archive..."
103 local size="$( diskusage "$extract_dir" )"
104 if [ "$size" -lt "$expected_min_size" ]; then
107 Invalid size ($size MB) of extracted archive. Probably you have not
108 enough free disc space in the temporary directory. Note: You can
109 specify an alternate directory by setting the environment variable
117 if [ "${#files[*]}" -ne 1 ]; then
120 Expected one file, but found the following ${#files[*]} files:
132 read_maintainer_info() {
133 if [ -z "$maintainer_name" ]; then
134 if [ -n "$DEBFULLNAME" ]; then
135 maintainer_name="$DEBFULLNAME"
136 elif [ -n "$DEBNAME" ]; then
137 maintainer_name="$DEBNAME"
139 default_name="$(getent passwd $(id -run) | cut -d: -f5| cut -d, -f1)"
143 Please enter your full name. This value will be used in the maintainer
144 field of the created package.
149 while [ -z "$maintainer_name" ]; do
150 read -e -p "Full name [$default_name]:" maintainer_name
151 if [ -z "$maintainer_name" ] && [ -n "$default_name" ]; then
152 maintainer_name="$default_name"
158 if [ -z "$maintainer_email" ]; then
160 if [ -n "$DEBEMAIL" ]; then
161 maintainer_email="$DEBEMAIL"
163 if [ -r "/etc/mailname" ]; then
164 default_email="$( id -run )@$( cat /etc/mailname )"
166 default_email="$( id -run )@$( hostname --fqdn )"
170 Please enter a valid email address or press return to accept the
171 default value. This address will be used in the maintainer field of
175 read -e -p "Email [$default_email]: " maintainer_email
176 if [ -z "$maintainer_email" ]; then
177 maintainer_email="$default_email"
183 # provide the architecture for evaluation by plugins
187 export DEB_BUILD_ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)
189 export DEB_BUILD_GNU_TYPE=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)
191 echo "Detected Debian build architecture: ${DEB_BUILD_ARCH:-N/A}"
193 echo "Detected Debian GNU type: ${DEB_BUILD_GNU_TYPE:-N/A}"
196 # get browser plugin directories
197 get_browser_plugin_dirs() {
198 if dpkg-vendor --derives-from Ubuntu; then
199 export browser_plugin_dirs="xulrunner-addons firefox iceape iceweasel mozilla midbrowser xulrunner"
201 export browser_plugin_dirs=mozilla