Created
February 23, 2012 08:00
-
-
Save sawanoboly/1891425 to your computer and use it in GitHub Desktop.
insatll packeage wrapper for SmartOS
This file contains hidden or 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
# insatll packeage wrapper for SmartOS | |
# install function | |
install_pkg () | |
{ | |
echo -n "Installing $1... " | |
# RESULT=`pkgin -y install $1 | grep -xv "$1 is not available on the repository"` | |
RESULT=`pkgin -y install $1` | |
echo "$RESULT" | grep -x "$1 is not available on the repository" > /dev/null | |
if [ $? -eq 0 ] | |
then | |
echo "NG" | |
echo | |
echo "/////////////////" | |
echo "Error! $1 is not available on the repository. Exiting.." | |
echo " Exiting.." | |
echo | |
exit 1 | |
fi | |
echo "$RESULT" | grep "packages to be installed" > /dev/null | |
if [ $? -eq 0 ] | |
then | |
echo "OK" | |
echo -n " " | |
echo "$RESULT" | grep "packages to be installed" | |
else | |
echo "$RESULT" | grep -x "nothing to do." > /dev/null | |
if [ $? -eq 0 ] | |
then | |
echo " nothing to do. $1 is already installed." | |
else | |
echo "NG" | |
echo | |
echo "/////////////////" | |
echo "Error! $1 does not install correctly." | |
echo " Exiting.." | |
echo | |
echo | |
exit 1 | |
fi | |
fi | |
} | |
# remove for test | |
remove_pkg () | |
{ | |
echo "Removing $1... " | |
# pkgin -y remove $1 >/dev/null | |
echo -n " " | |
pkgin -y remove $1 | grep "packages to delete" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment