##// END OF EJS Templates
fix: confirm y/n installation of required packages
Jan Wagner -
r8:ba0ef8aae187
parent child
Show More
@@ -71,6 +71,9 R=${BUILDDIR}/chroot
71 # Packages required for bootstrapping
71 # Packages required for bootstrapping
72 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static dosfstools rsync bmap-tools whois git-core"
72 REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static dosfstools rsync bmap-tools whois git-core"
73
73
74 # Missing packages that need to be installed
75 MISSING_PACKAGES=""
76
74 # Packages required in the chroot build enviroment
77 # Packages required in the chroot build enviroment
75 APT_INCLUDES="apt-transport-https,ca-certificates,debian-archive-keyring,dialog,locales,apt-utils,vim-tiny"
78 APT_INCLUDES="apt-transport-https,ca-certificates,debian-archive-keyring,dialog,locales,apt-utils,vim-tiny"
76
79
@@ -82,6 +85,29 if [ "$(id -u)" -ne "0" ] ; then
82 exit 1
85 exit 1
83 fi
86 fi
84
87
88 # Check if all required packages are installed
89 for package in $REQUIRED_PACKAGES ; do
90 if [ "`dpkg-query -W -f='${Status}' $package`" != "install ok installed" ] ; then
91 MISSING_PACKAGES="$MISSING_PACKAGES $package"
92 fi
93 done
94
95 # Ask if missing packages should get installed right now
96 if [ -n "$MISSING_PACKAGES" ] ; then
97 echo "the following packages needed by this script are not installed:"
98 echo "$MISSING_PACKAGES"
99
100 echo -n "\ndo you want to install the missing packages right now? [y/n] "
101 read confirm
102 if [ "$confirm" != "y" ] ; then
103 exit 1
104 fi
105 fi
106
107 # Make sure all required packages are installed
108 apt-get -qq -y install ${REQUIRED_PACKAGES}
109 exit
110
85 # Don't clobber an old build
111 # Don't clobber an old build
86 if [ -e "$BUILDDIR" ]; then
112 if [ -e "$BUILDDIR" ]; then
87 echo "directory $BUILDDIR already exists, not proceeding"
113 echo "directory $BUILDDIR already exists, not proceeding"
@@ -96,9 +122,6 trap cleanup 0 1 2 3 6
96 # Set up chroot directory
122 # Set up chroot directory
97 mkdir -p $R
123 mkdir -p $R
98
124
99 # Install dependencies
100 apt-get -q -y install ${REQUIRED_PACKAGES}
101
102 # Use traditional SystemV init instead of systemd services
125 # Use traditional SystemV init instead of systemd services
103 if [ "$ENABLE_SYSTEMD" = false ] ; then
126 if [ "$ENABLE_SYSTEMD" = false ] ; then
104 APT_INCLUDES="${APT_INCLUDES},sysvinit-core"
127 APT_INCLUDES="${APT_INCLUDES},sysvinit-core"
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant