nix-tools/lib/build-api.sh

77 lines
1.6 KiB
Bash
Raw Normal View History

2014-10-08 00:11:53 +02:00
#!/bin/bash
2014-10-08 11:11:19 +02:00
#
2014-10-08 00:11:53 +02:00
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
2014-10-08 11:11:19 +02:00
shopt -s nullglob
2014-10-08 00:11:53 +02:00
ch_owner(){
2014-11-12 04:15:07 +01:00
msg "chown -R [$USER:users] [$1]"
chown -R "$USER:users" "$1"
2014-10-08 00:11:53 +02:00
}
sign_pkgs(){
cd $pkgdir
2014-11-12 04:15:07 +01:00
su $USER <<'EOF'
2014-10-08 00:11:53 +02:00
signpkgs
EOF
}
get_profiles(){
local prof= temp=
2014-10-08 11:11:19 +02:00
for item in $(ls ${profiledir}/*.set);do
temp=${item##*/}
2014-10-08 00:11:53 +02:00
prof=${prof:-}${prof:+|}${temp%.set}
done
echo $prof
}
prepare_dir(){
if ! [[ -d $1 ]];then
mkdir -p $1
fi
}
2014-11-11 21:19:26 +01:00
clean_dir(){
msg2 "Cleaning $1 ..."
rm -r $1/*
}
git_clean(){
msg2 "Cleaning $(pwd) ..."
git clean -dfx$1
}
2014-10-08 11:11:19 +02:00
eval_profile(){
eval "case ${profile} in
$(get_profiles)) is_profile=true ;;
*) is_profile=false ;;
esac"
}
2014-10-23 00:46:43 +02:00
blacklist_pkg(){
local blacklist=('libsystemd') cmd=$(pacman -Q ${blacklist[@]} -r ${chrootdir}/root 2> /dev/null)
if [[ -n $cmd ]] ; then
msg2 "Removing blacklisted [${blacklist[@]}] ..."
2014-11-12 02:19:58 +01:00
setarch "${arch}" pacman -Rdd "${blacklist[@]}" -r ${chrootdir}/root --noconfirm
2014-10-23 00:46:43 +02:00
else
msg2 "Blacklisted [${blacklist[@]}] not present."
fi
}
move_pkg(){
msg2 "Moving [$1] to [${pkgdir}]"
local ext='pkg.tar.xz'
mv *.${ext} ${pkgdir}/
}
2014-11-12 04:15:07 +01:00
# get_branch(){
# local branch=${mirrors_conf##*-}
# echo ${branch%.*}
# }