Last active
December 22, 2019 04:48
-
-
Save Hayao0819/3389c0ab2f000da13dbfe8e06315131b to your computer and use it in GitHub Desktop.
package-gui-installer用のAURビルドスクリプト
This file contains 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
#!/usr/bin/env bash | |
## 変数 | |
working_directory=/tmp/build | |
export_directory=/tmp | |
## Rootチェック | |
if [[ $UID = 0 ]]; then | |
echo "Rootで実行しないでください。" | |
exit 1 | |
fi | |
# 引数チェック | |
if [[ -f $1 ]]; then | |
add_pkg_aur=($(cat $1)) | |
elif [[ -z $@ ]]; then | |
echo "何も指定されていません。" | |
exit 1 | |
else | |
add_pkg_aur=$1 | |
fi | |
## Gitチェック | |
if [[ -z $( pacman -Q | awk '{print $1}' | grep -x "git" ) ]]; then | |
sudo pacman -Syy | |
sudo pacman -S git | |
fi | |
# 作業ディレクトリ作成 | |
if [[ ! -d $working_directory ]]; then | |
mkdir -p $working_directory | |
fi | |
## ビルド | |
# Clone | |
if [[ -d $working_directory/$1 ]]; then | |
rm -rf $working_directory/$1 | |
fi | |
git clone https://aur.archlinux.org/$1.git $working_directory/$1 | |
# ビルド | |
cd $working_directory/$1 | |
source PKGBUILD | |
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY pacman -S --noconfirm ${depends[@]} | |
makepkg --noconfirm | |
mv $1*.pkg.tar.xz $export_directory | |
## 作業ディレクトリ削除 | |
rm -fr $working_directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment