mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-07 16:45:37 +00:00
lxc-download: Add interactive mode
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
c4e9c69f51
commit
b0f0932a94
@ -41,9 +41,11 @@ DOWNLOAD_USE_CACHE="false"
|
|||||||
DOWNLOAD_URL=
|
DOWNLOAD_URL=
|
||||||
DOWNLOAD_SHOW_HTTP_WARNING="true"
|
DOWNLOAD_SHOW_HTTP_WARNING="true"
|
||||||
DOWNLOAD_SHOW_GPG_WARNING="true"
|
DOWNLOAD_SHOW_GPG_WARNING="true"
|
||||||
|
DOWNLOAD_READY_GPG="false"
|
||||||
DOWNLOAD_COMPAT_LEVEL=1
|
DOWNLOAD_COMPAT_LEVEL=1
|
||||||
DOWNLOAD_LIST_IMAGES="false"
|
DOWNLOAD_LIST_IMAGES="false"
|
||||||
DOWNLOAD_BUILD=
|
DOWNLOAD_BUILD=
|
||||||
|
DOWNLOAD_INTERACTIVE="false"
|
||||||
|
|
||||||
LXC_NAME=
|
LXC_NAME=
|
||||||
LXC_PATH=
|
LXC_PATH=
|
||||||
@ -95,6 +97,10 @@ gpg_setup() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$DOWNLOAD_READY_GPG" = "true" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Setting up the GPG keyring"
|
echo "Setting up the GPG keyring"
|
||||||
|
|
||||||
mkdir -p "$DOWNLOAD_TEMP/gpg"
|
mkdir -p "$DOWNLOAD_TEMP/gpg"
|
||||||
@ -105,6 +111,8 @@ gpg_setup() {
|
|||||||
echo "ERROR: Unable to fetch GPG key from keyserver."
|
echo "ERROR: Unable to fetch GPG key from keyserver."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DOWNLOAD_READY_GPG="true"
|
||||||
}
|
}
|
||||||
|
|
||||||
gpg_validate() {
|
gpg_validate() {
|
||||||
@ -234,11 +242,9 @@ if [ "$(in_userns)" = "yes" ]; then
|
|||||||
DOWNLOAD_MODE="user"
|
DOWNLOAD_MODE="user"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ([ -z "$DOWNLOAD_DIST" ] || [ -z "$DOWNLOAD_RELEASE" ] || \
|
if [ -z "$DOWNLOAD_DIST" ] || [ -z "$DOWNLOAD_RELEASE" ] || \
|
||||||
[ -z "$DOWNLOAD_ARCH" ]) && [ "$DOWNLOAD_LIST_IMAGES" = "false" ]; then
|
[ -z "$DOWNLOAD_ARCH" ]; then
|
||||||
echo "ERROR: Missing required argument" 1>&2
|
DOWNLOAD_INTERACTIVE="true"
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Trap all exit signals
|
# Trap all exit signals
|
||||||
@ -246,7 +252,8 @@ trap cleanup EXIT HUP INT TERM
|
|||||||
DOWNLOAD_TEMP=$(mktemp -d)
|
DOWNLOAD_TEMP=$(mktemp -d)
|
||||||
|
|
||||||
# Simply list images
|
# Simply list images
|
||||||
if [ "$DOWNLOAD_LIST_IMAGES" = "true" ]; then
|
if [ "$DOWNLOAD_LIST_IMAGES" = "true" ] || \
|
||||||
|
[ "$DOWNLOAD_INTERACTIVE" = "true" ]; then
|
||||||
# Initialize GPG
|
# Initialize GPG
|
||||||
gpg_setup
|
gpg_setup
|
||||||
|
|
||||||
@ -287,7 +294,29 @@ if [ "$DOWNLOAD_LIST_IMAGES" = "true" ]; then
|
|||||||
done < ${DOWNLOAD_TEMP}/index
|
done < ${DOWNLOAD_TEMP}/index
|
||||||
echo "---"
|
echo "---"
|
||||||
|
|
||||||
exit 1
|
if [ "$DOWNLOAD_LIST_IMAGES" = "true" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Interactive mode
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if [ -z "$DOWNLOAD_DIST" ]; then
|
||||||
|
echo -n "Distribution: "
|
||||||
|
read DOWNLOAD_DIST
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$DOWNLOAD_RELEASE" ]; then
|
||||||
|
echo -n "Release: "
|
||||||
|
read DOWNLOAD_RELEASE
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$DOWNLOAD_ARCH" ]; then
|
||||||
|
echo -n "Architecture: "
|
||||||
|
read DOWNLOAD_ARCH
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup the cache
|
# Setup the cache
|
||||||
|
Loading…
Reference in New Issue
Block a user