Ajout script de vérification d'installation

This commit is contained in:
wpetit 2015-07-04 13:28:43 +02:00
parent afe7725c1b
commit ab10d60215
3 changed files with 29 additions and 9 deletions

View File

@ -1,7 +1,5 @@
#!/usr/bin/env bash
source ./lib/util.sh
function show_usage {
@ -24,13 +22,16 @@ function create_container {
# Create temporary dir for the Dockerfile
temp_dir="$(mktemp -d)"
# Link lib folder
ln -s $(readlink -f ./lib) "$temp_dir/lib"
# Create Dockerfile
cat << EOF > "$temp_dir/Dockerfile"
FROM $BASE_IMAGE
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get update && apt-get install --yes gdebi-core
ADD ./lib /root/.tamarin
RUN chmod +x /root/.tamarin/install.sh
@ -53,8 +54,20 @@ EOF
}
function main {
# Create container image
container_tag=$(create_container)
# Run container and install package
docker run -e "DISTRIB=$BASE_IMAGE" --rm -v="$DEB_DIR:/deb" "$container_tag" "/deb/$DEB_NAME"
# Check for return
if [ $? != 0 ]; then
fatal "Installation did not complete correctly !"
fi
info "Installation complete."
}
# Test for arguments

View File

@ -43,8 +43,7 @@ function exec_hook {
# If the script did not execute properly, we stop here
if [ $? != 0 ]; then
error "The '${hook_name}' hook script did not finished properly !"
exit 1
fatal "The '${hook_name}' hook script did not finished properly !"
fi
}
@ -68,7 +67,7 @@ function create_debian_control_file {
package_priority=$(get_project_opt .priority)
echo "Priority: ${package_priority:-optional}" >> "${control_file}"
package_arch=$(get_project_opt .package_arch)
package_arch=$(get_project_opt .arch)
echo "Architecture: ${package_arch:-all}" >> "${control_file}"
dependencies=$( get_project_opt ".dependencies | .[\"${DISTRIB}\"] | @sh" | sed "s/' '/, /g" | sed "s/'//g" )
@ -158,8 +157,7 @@ function build_project {
info "Package created ! (${build_dir}/${project_name}.deb)"
if [ $? != 0 ]; then
error "The build process has not completed successfuly !"
exit 1
fatal "The build process has not completed successfuly !"
fi
cd ${SRC_DIR}

View File

@ -1,3 +1,12 @@
#!/usr/bin/env bash
dpkg --install "$1" || apt-get install -f
set -e
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "${DIR}/util.sh"
info "Updating packages definition..."
apt-get update
info "Installing package $1..."
gdebi --n "$1"