页次: 1
vim ~/usr/bin/getsrc
输入以下代码:
#!/bin/bash
# This script is used for downloading package source tarball under Archlinux, just like apt-get source pkg in ubuntu.
#make sure abs is installed
pacman -Q abs >/dev/null 2>&1
if [ $? -ne 0 ];then
echo "abs is not installed."
echo "installing abs..."
if [ `whoami` == "root" ];then
pacman -S abs
abs -t
else
sudo pacman -S abs
if [ $? -ne 0 ];then
exit
fi
sudo abs -t
fi
fi
#geting source through the PKGBUILD file
find /var/abs -type d -name $1 -exec cp -a {} /tmp/ \;
if [ -d /tmp/$1 ];then
echo package found.
else
echo "package $1 not found."
exit
fi
pushd /tmp/$1 >/dev/null 2>&1
#sed -i 's:\./configure.*$:exit:' PKGBUILD
makepkg -od --asroot
popd >/dev/null 2>&1
#cp -a /tmp/$1/src ./$1 >/dev/null 2>&1
mkdir -p ~/Source/$1
cp -a /tmp/$1/src/* ~/Source/$1
chmod +x /usr/bin/getsrc
离线
页次: 1