Created
April 10, 2018 06:00
-
-
Save mogi/9f97bd46db394ceabd1de1f4baf0d493 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This command is make sure current version and target version are equal. | |
PACKAGE_NAME=$1 | |
PREF_FILE="/etc/apt/preferences.d/${PACKAGE_NAME}.pref" | |
if [ ! -e "${PREF_FILE}" ]; then | |
echo "${PACKAGE_NAME}.pref is not found. Before using, please deploy config file of 'apt pinning'." | |
exit 1 | |
fi | |
PACKAGE_VERSION=$(grep 'Pin:' "${PREF_FILE}"| sed -e 's/Pin: release v=//') | |
# check package version | |
dpkg -s ${PACKAGE_NAME}| grep -q "Version: ${PACKAGE_VERSION}" && exit 0 || exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment