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 #!/usr/bin/env bash
source ./lib/util.sh source ./lib/util.sh
function show_usage { function show_usage {
@ -24,13 +22,16 @@ function create_container {
# Create temporary dir for the Dockerfile # Create temporary dir for the Dockerfile
temp_dir="$(mktemp -d)" temp_dir="$(mktemp -d)"
# Link lib folder
ln -s $(readlink -f ./lib) "$temp_dir/lib"
# Create Dockerfile # Create Dockerfile
cat << EOF > "$temp_dir/Dockerfile" cat << EOF > "$temp_dir/Dockerfile"
FROM $BASE_IMAGE FROM $BASE_IMAGE
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update RUN apt-get update && apt-get install --yes gdebi-core
ADD ./lib /root/.tamarin ADD ./lib /root/.tamarin
RUN chmod +x /root/.tamarin/install.sh RUN chmod +x /root/.tamarin/install.sh
@ -53,8 +54,20 @@ EOF
} }
function main { function main {
# Create container image
container_tag=$(create_container) 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" 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 # Test for arguments

View File

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

View File

@ -1,3 +1,12 @@
#!/usr/bin/env bash #!/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"