[通告] 本论坛迁移啦~请前往位于 https://forum.archlinuxcn.org/ 的新论坛。所有帖子和参与的用户都已经迁移。
您正在访问的是原 bbs.archlinuxcn.org 的静态存档。本页面的新地址位于 https://forum.archlinuxcn.org/t/topic/5563。
页次: 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/$1chmod +x /usr/bin/getsrc离线
页次: 1