apt-msys2
This is a file similar to apt-cyg. It will install packages from the MSYS2 project. It will only be practical for packages from the "MINGW" repo, as packages from the "MSYS2" repo would require the MSYS2 dll. I have a need for this because Cygwin Tcl/Tk requires X11. MSYS2 Tcl/Tk does not require X11, so it can run much faster.
This commit is contained in:
parent
461d5955e9
commit
d5a8c42eb1
|
@ -0,0 +1,116 @@
|
|||
#!/bin/bash
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2014 Steven Penny
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
usage () {
|
||||
local rw=(
|
||||
'apt-msys2 [command] [packages]'
|
||||
''
|
||||
'Commands:'
|
||||
' install <packages> install packages'
|
||||
' search <patterns> search for a filename from all available packages'
|
||||
)
|
||||
printf '%s\n' "${rw[@]}"
|
||||
}
|
||||
|
||||
urlencode () {
|
||||
sed '
|
||||
s / %2f g
|
||||
s : %3a g
|
||||
' <<< "$1"
|
||||
}
|
||||
|
||||
findworkspace () {
|
||||
mirror=http://downloads.sourceforge.net/project/msys2
|
||||
repo=REPOS/MINGW/$ARCH
|
||||
local mirrordir=/var/cache/$(urlencode $mirror)/$repo
|
||||
mkdir -p $mirrordir
|
||||
cd $mirrordir
|
||||
}
|
||||
|
||||
getdb () {
|
||||
[ -a mingw64.files.tar.gz ] && return
|
||||
wget $mirror/$repo/mingw64.files.tar.gz
|
||||
tar --no-an -Oxf mingw64.files.tar.gz desc files > mingw64.lst
|
||||
}
|
||||
|
||||
apt-install () {
|
||||
findworkspace
|
||||
getdb
|
||||
local pkg file
|
||||
for pkg in ${packages[*]}
|
||||
do
|
||||
file=$(awk '$5 == pkg, $0 = $2' pkg=$pkg RS=%FILENAME% FS='\n' mingw64.lst)
|
||||
wget -nc $mirror/$repo/$file
|
||||
tar --str 1 -x -C / -f $file
|
||||
echo Package $pkg installed
|
||||
done
|
||||
}
|
||||
|
||||
apt-search () {
|
||||
findworkspace
|
||||
getdb
|
||||
for pkg in ${packages[*]}
|
||||
do
|
||||
awk '
|
||||
$0 ~ pkg {
|
||||
print $5
|
||||
}
|
||||
' pkg="$pkg" RS=%FILENAME% FS='\n' mingw64.lst
|
||||
done
|
||||
}
|
||||
|
||||
while (( $# ))
|
||||
do
|
||||
case "$1" in
|
||||
|
||||
install | search)
|
||||
if [[ $command ]]
|
||||
then
|
||||
packages+=($1)
|
||||
else
|
||||
command=$1
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
|
||||
*)
|
||||
packages+=($1)
|
||||
shift
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $HOSTTYPE = x86_64 ]
|
||||
then
|
||||
ARCH=x86_64
|
||||
else
|
||||
ARCH=x86
|
||||
fi
|
||||
|
||||
if type -t apt-$command | grep -q function
|
||||
then
|
||||
apt-$command
|
||||
else
|
||||
usage
|
||||
fi
|
Loading…
Reference in New Issue