forked from mirrored-repos/manjaro-tools
add buildtree
This commit is contained in:
parent
faba16634b
commit
3cc109e70c
5 changed files with 165 additions and 23 deletions
11
Makefile
11
Makefile
|
@ -19,7 +19,8 @@ BINPROGS = \
|
|||
bin/chroot-run \
|
||||
bin/mkiso \
|
||||
bin/buildiso \
|
||||
bin/testiso
|
||||
bin/testiso \
|
||||
bin/buildtree
|
||||
|
||||
SYSCONFIGFILES = \
|
||||
conf/manjaro-tools.conf
|
||||
|
@ -102,8 +103,8 @@ install:
|
|||
install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools/scripts
|
||||
install -m0644 ${SCRIPTS} $(DESTDIR)$(PREFIX)/share/manjaro-tools/scripts
|
||||
|
||||
#install -Dm0644 bin/bash_completion $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools
|
||||
#install -Dm0644 bin/zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools
|
||||
# install -Dm0644 bin/bash_completion $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools
|
||||
# install -Dm0644 bin/zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools
|
||||
|
||||
uninstall:
|
||||
for f in ${SYSCONFIGFILES}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/$$f; done
|
||||
|
@ -117,8 +118,8 @@ uninstall:
|
|||
for f in ${CPIOINST}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/install/$$f; done
|
||||
for f in ${SCRIPTS}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/scripts/$$f; done
|
||||
|
||||
#rm $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools
|
||||
#rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools
|
||||
# rm $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools
|
||||
# rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools
|
||||
|
||||
dist:
|
||||
git archive --format=tar --prefix=manjaro-tools-$(V)/ $(V) | gzip -9 > manjaro-tools-$(V).tar.gz
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
# _manjaro_tools_compgen() {
|
||||
# local i r
|
||||
# COMPREPLY=($(compgen -W '$*' -- "$cur"))
|
||||
# for ((i=1; i < ${#COMP_WORDS[@]}-1; i++)); do
|
||||
# for r in ${!COMPREPLY[@]}; do
|
||||
# if [[ ${COMP_WORDS[i]} = ${COMPREPLY[r]} ]]; then
|
||||
# unset 'COMPREPLY[r]'; break
|
||||
# fi
|
||||
# done
|
||||
# done
|
||||
# }
|
||||
|
||||
_mkchrootpkg() {
|
||||
local cur
|
||||
COMPREPLY=()
|
||||
|
@ -36,7 +24,7 @@ _mkchroot() {
|
|||
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W '-C -M -S -c -h' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '-C -M -S -c -L -B -h' -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
_filedir
|
||||
|
@ -55,7 +43,7 @@ _chroot_run() {
|
|||
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W '-C -M -S -c -h' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '-C -M -S -c -B -h' -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
_filedir
|
||||
|
@ -67,14 +55,14 @@ _chroot_run() {
|
|||
} &&
|
||||
complete -F _chroot_run chroot-run
|
||||
|
||||
_build_set() {
|
||||
_buildpkg() {
|
||||
local cur
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur
|
||||
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W '-a -b -p -c -r -w -s -h' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '-a -b -p -c -r -w -s -q -h' -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
_filedir
|
||||
|
@ -84,7 +72,23 @@ _build_set() {
|
|||
|
||||
true
|
||||
} &&
|
||||
complete -F _build_set build-set
|
||||
complete -F _buildpkg buildpkg
|
||||
|
||||
_buildiso() {
|
||||
local cur
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur
|
||||
|
||||
# ex:et ts=2 sw=2 ft=sh
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W '-a -b -p -c -r -i -s -x -l -q -h' -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
true
|
||||
} &&
|
||||
complete -F _buildiso buildiso
|
||||
|
|
104
bin/buildtree.in
Normal file
104
bin/buildtree.in
Normal file
|
@ -0,0 +1,104 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# 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.
|
||||
|
||||
version=@version@
|
||||
|
||||
LIBDIR='@libdir@'
|
||||
SYSCONFDIR='@sysconfdir@'
|
||||
|
||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||
[[ -r ${LIBDIR}/util.sh ]] && source ${LIBDIR}/util.sh
|
||||
|
||||
display_settings(){
|
||||
msg "manjaro-tools"
|
||||
msg2 "version: ${version}"
|
||||
|
||||
if [[ -f ${USER_CONFIG}/manjaro-tools.conf ]]; then
|
||||
msg2 "user_config: ${USER_CONFIG}/manjaro-tools.conf"
|
||||
else
|
||||
msg2 "manjaro_tools_conf: ${manjaro_tools_conf}"
|
||||
fi
|
||||
|
||||
msg "ARGS:"
|
||||
msg2 "sync: ${sync}"
|
||||
msg2 "abs: ${abs}"
|
||||
|
||||
msg "PATHS:"
|
||||
msg2 "tree_dir: ${tree_dir}"
|
||||
msg2 "repo_tree: ${repo_tree[*]}"
|
||||
msg2 "host_tree: ${host_tree}"
|
||||
msg2 "host_tree_abs: ${host_tree_abs}"
|
||||
}
|
||||
|
||||
prepare_dir(){
|
||||
[[ ! -d $1 ]] && mkdir -p $1
|
||||
}
|
||||
|
||||
sync_tree(){
|
||||
cd $1
|
||||
for repo in ${repo_tree[@]};do
|
||||
msg "Syncing $repo ..."
|
||||
git clone ${host_tree}/packages-$repo.git #branch=$branch
|
||||
done
|
||||
cd ..
|
||||
if ${abs}; then
|
||||
cd $1/abs
|
||||
msg "Syncing abs ..."
|
||||
git clone ${host_tree_abs}.git
|
||||
cd ..
|
||||
fi
|
||||
}
|
||||
|
||||
load_user_info
|
||||
|
||||
load_config "${USER_CONFIG}/manjaro-tools.conf"
|
||||
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
||||
|
||||
sync=true
|
||||
pretend=false
|
||||
abs=false
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options]"
|
||||
echo " -s Sync tree"
|
||||
echo " -a Include arch abs"
|
||||
echo ' -h This help'
|
||||
echo ' -q Query settings'
|
||||
echo ''
|
||||
echo ''
|
||||
exit $1
|
||||
}
|
||||
|
||||
orig_argv=("$@")
|
||||
|
||||
opts='saqh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
s) sync=false ;;
|
||||
a) abs=true ;;
|
||||
q) pretend=true ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
tree_dir=${cache_dir}/pkgtree
|
||||
|
||||
check_root "$0" "${orig_argv[@]}"
|
||||
|
||||
prepare_dir "${tree_dir}/abs"
|
||||
|
||||
${pretend} && display_settings && exit 1
|
||||
|
||||
${sync} && sync_tree "${tree_dir}"
|
|
@ -11,6 +11,17 @@
|
|||
# cache dir where buildpkg or buildiso cache packages
|
||||
# cache_dir=/var/cache/manjaro-tools
|
||||
|
||||
##########################################
|
||||
################ buildtree ###############
|
||||
##########################################
|
||||
|
||||
# manjaro package tree
|
||||
# repo_tree=('core' 'extra' 'community' 'multilib' 'openrc')
|
||||
|
||||
# host_tree=https://github.com/manjaro
|
||||
|
||||
# host_tree_abs=https://projects.archlinux.org/git/svntogit/packages
|
||||
|
||||
##########################################
|
||||
################ buildpkg ################
|
||||
##########################################
|
||||
|
|
22
lib/util.sh
22
lib/util.sh
|
@ -191,6 +191,28 @@ load_config(){
|
|||
cache_dir='/var/cache/manjaro-tools'
|
||||
fi
|
||||
|
||||
###################
|
||||
# buildtree
|
||||
###################
|
||||
|
||||
if [[ -n ${repo_tree} ]];then
|
||||
repo_tree=${repo_tree}
|
||||
else
|
||||
repo_tree=(core extra community multilib openrc)
|
||||
fi
|
||||
|
||||
if [[ -n ${host_tree} ]];then
|
||||
host_tree=${host_tree}
|
||||
else
|
||||
host_tree='https://github.com/manjaro'
|
||||
fi
|
||||
|
||||
if [[ -n ${host_tree_abs} ]];then
|
||||
host_tree_abs=${host_tree_abs}
|
||||
else
|
||||
host_tree_abs='https://projects.archlinux.org/git/svntogit/packages'
|
||||
fi
|
||||
|
||||
###################
|
||||
# buildpkg
|
||||
###################
|
||||
|
|
Loading…
Reference in a new issue