/usr/bin/avopkg is in avogadro 1.0.3-10.1+b2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | #!/bin/sh
# Avogadro Package Manager v 1.0
# Copyright (C) 2010 Konstantin Tokarev
#
# For more information about Avogadro, see
# <http://avogadro.openmolecules.net/>
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation.
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
PREFIX="/usr"
LIB_DIR="lib"
PLUGIN_DIR="avogadro/1_0"
PYTHON_ENABLED="ON"
IS_UNIX="1"
IS_MAC=""
PACK_CMD="tar czf"
EXTRACT_CMD="tar xzf"
# Helper functions
# /**
# * Returns value of variable from package configuration
# * @param $1 package description file name
# * @param $2 variable name
# * @returns variable value (may NOT contain spaces!)
# */
getVar()
{
#extract last field of string using ' ' as delimiter
echo `cat $1 | grep $2 | awk '{print $NF}'`
}
# /**
# * Returns value of multi-string variable from package configuration
# * @param $1 package description file name
# * @param $2 variable name
# * @returns variable value (may contain spaces!)
# */
getMultiVar()
{
#extract last field of string using ':' as delimiter
echo `cat $1 | grep $2 | awk -F':' '{print $NF}'`
}
# /**
# * Returns value of boolean variable from package configuration
# * @param $1 package description file name
# * @param $2 variable name
# * @returns 0 if string $2 was found in file $1
# */
getBoolVar()
{
#exit 0 if file contains string $2
echo test x`cat $1 | grep $2` != x
#echo $?
}
# Main script
echo "Avopkg v1.0"
if test "$1" = "-pack"
then
########## Create package ##########
if test -e $2
then
echo "Building package for $(getMultiVar $2 Name) ..."
else
echo "Usage: $0 -pack filename"
echo "Type 'man avopkg' for more details"
exit 0
fi
#echo Package files: $files
# Use tar.gz compression
package=$(getVar $2 Package)
files="$(getMultiVar $2 Files)"
rm -rf .tmp
mkdir -p .tmp/$package
cp $2 .tmp/$package/$package.mf
cp -t .tmp/$package $files # Will fail if some file is missing
cd .tmp
$PACK_CMD ../$package.avo $package
cd ..
rm -rf .tmp
echo Done!
else
########## Install package ##########
if test -e $1
then
package=`basename $1 .avo`
echo Unpacking $1...
else
echo "Usage: $0 filename"
echo "Type 'man avopkg' for more details"
exit 0
fi
# Create temporary dir and unpack content
rm -rf .tmp
mkdir .tmp
cd .tmp
$EXTRACT_CMD ../$1
if ! test $? = 0
then
echo "$1 is not an Avogadro plugin package!"
echo "Installation failed."
exit 1
fi
# Check manifest
cd $package
manifest=$package.mf
if ! test -f $manifest
then
echo "Manifest $manifest is missing in package!"
echo "Installation failed."
exit 1
fi
# Find out where to install package
if ($(getBoolVar $manifest Python))
then
#Check Python support in Avogadro
if test $PYTHON_ENABLED = "OFF"
then
echo "Plugin $package needs Python, but Avogadro was compiled"
echo "without Python support. To install and use this plugin, you need to change CMake"
echo "option ENABLE_PYTHON to ON value, resolve dependencies and re-compile Avogadro"
echo
echo "Installation failed."
exit 1
fi
echo -n Installing Python plugin $package
if test $USER = root
then
echo " for all users..."
dest="$PREFIX/share/libavogadro/$(getVar $manifest Category)Scripts"
else
echo " for user $USER"
if test "$IS_MAC" = 1
then
dest="$HOME/Library/Application Support/Avogadro/$(getVar $manifest Category)Scripts"
else
dest="$HOME/.avogadro/$(getVar $manifest Category)Scripts"
fi
fi
else
echo -n Installing plugin $package
if test $USER = root
then
echo " for all users..."
dest="$PREFIX/$LIB_DIR/$PLUGIN_DIR/$(getVar $manifest Category)"
else
echo " for user $USER"
if test "$IS_MAC" = 1
then
dest="$HOME/Library/Application Support/$PLUGIN_DIR/Plugins/$(getVar $manifest Category)"
else
dest="$HOME/.$PLUGIN_DIR/plugins/$(getVar $manifest Category)"
fi
fi
fi
# Copy files
if ! test -d "$dest"
then
echo Creating directory $dest...
mkdir -p "$dest"
fi
echo "Copying files to $dest..."
cp -t "$dest" $(getMultiVar $manifest Files)
# Clean up
cd ../..
rm -rf .tmp
echo Done.
fi
|