← Back
Editing: install_language_package
#!/bin/sh LANGUAGE=$1 VERSION=$2 logger "install_language_package called by $SUDO_USER: $@" if [ "$#" -ne 2 ] then echo "Usage: install_language_package <language> <version>" exit 1 fi # Call alwrapper to verify the specified language + version exists and transform # major versions into the the latest minor version. VERSION=$(alwrapper resolve_version $LANGUAGE $VERSION) if [ -z "$VERSION" ] then exit 2 fi # If called directly by root and the language is already installed, do nothing. # The user must be root, otherwise that script could be used to find out what # directories exist on the system. if [ -z "$SUDO_USER" -a -d /usr/alwaysdata/$LANGUAGE/$VERSION ] then exit 3 fi PACKAGE="$LANGUAGE-$VERSION" # Check that the package is not already installed. if dpkg-query --show $PACKAGE 2>/dev/null | cut -f2 | grep -qv '^$' then exit 4 fi # Check that the package exists AND that it's done by alwaysdata. if ! apt-cache show $PACKAGE 2>&1 | grep -q "Maintainer: .* <.*@alwaysdata.com>" then exit 5 fi # Wait until the dpkg locks are available. while fuser /var/lib/dpkg/lock* >/dev/null 2>&1 do sleep 0.5 done DEBIAN_FRONTEND=noninteractive apt-get --yes install $PACKAGE >/dev/null 2>&1
Save File
Cancel