2014-10-08 00:11:53 +02:00
|
|
|
#!/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.
|
|
|
|
|
2015-02-09 23:38:12 +01:00
|
|
|
import(){
|
2015-02-13 15:17:00 +01:00
|
|
|
[[ -r $1 ]] && source $1
|
2015-02-09 23:38:12 +01:00
|
|
|
}
|
|
|
|
|
2015-02-18 04:28:11 +01:00
|
|
|
get_timer(){
|
|
|
|
echo $(date +%s)
|
|
|
|
}
|
|
|
|
|
|
|
|
# $1: start timer
|
|
|
|
elapsed_time(){
|
|
|
|
echo $(echo $1 $(get_timer) | awk '{ printf "%0.2f",($2-$1)/60 }')
|
|
|
|
}
|
|
|
|
|
2014-10-08 00:11:53 +02:00
|
|
|
##
|
|
|
|
# usage : in_array( $needle, $haystack )
|
|
|
|
# return : 0 - found
|
|
|
|
# 1 - not found
|
|
|
|
##
|
|
|
|
in_array() {
|
2015-02-13 15:17:00 +01:00
|
|
|
local needle=$1; shift
|
|
|
|
local item
|
|
|
|
for item in "$@"; do
|
|
|
|
[[ $item = $needle ]] && return 0 # Found
|
|
|
|
done
|
|
|
|
return 1 # Not Found
|
2014-11-11 23:02:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# $1: sofile
|
|
|
|
# $2: soarch
|
|
|
|
process_sofile() {
|
2015-02-13 15:17:00 +01:00
|
|
|
# extract the library name: libfoo.so
|
|
|
|
local soname="${1%.so?(+(.+([0-9])))}".so
|
|
|
|
# extract the major version: 1
|
|
|
|
soversion="${1##*\.so\.}"
|
|
|
|
if [[ "$soversion" = "$1" ]] && (($IGNORE_INTERNAL)); then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
if ! in_array "${soname}=${soversion}-$2" ${soobjects[@]}; then
|
2014-11-11 23:02:40 +01:00
|
|
|
# libfoo.so=1-64
|
2015-02-13 15:17:00 +01:00
|
|
|
msg "${soname}=${soversion}-$2"
|
|
|
|
soobjects+=("${soname}=${soversion}-$2")
|
|
|
|
fi
|
2014-10-08 00:11:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
##
|
|
|
|
# usage : get_full_version( [$pkgname] )
|
|
|
|
# return : full version spec, including epoch (if necessary), pkgver, pkgrel
|
|
|
|
##
|
2014-11-11 23:02:40 +01:00
|
|
|
get_full_version() {
|
2015-02-13 15:17:00 +01:00
|
|
|
# set defaults if they weren't specified in buildfile
|
|
|
|
pkgbase=${pkgbase:-${pkgname[0]}}
|
|
|
|
epoch=${epoch:-0}
|
|
|
|
if [[ -z $1 ]]; then
|
|
|
|
if [[ $epoch ]] && (( ! $epoch )); then
|
|
|
|
echo $pkgver-$pkgrel
|
|
|
|
else
|
|
|
|
echo $epoch:$pkgver-$pkgrel
|
|
|
|
fi
|
2014-11-11 23:02:40 +01:00
|
|
|
else
|
2015-02-13 15:17:00 +01:00
|
|
|
for i in pkgver pkgrel epoch; do
|
|
|
|
local indirect="${i}_override"
|
|
|
|
eval $(declare -f package_$1 | sed -n "s/\(^[[:space:]]*$i=\)/${i}_override=/p")
|
|
|
|
[[ -z ${!indirect} ]] && eval ${indirect}=\"${!i}\"
|
|
|
|
done
|
|
|
|
if (( ! $epoch_override )); then
|
|
|
|
echo $pkgver_override-$pkgrel_override
|
|
|
|
else
|
|
|
|
echo $epoch_override:$pkgver_override-$pkgrel_override
|
|
|
|
fi
|
2014-10-08 00:11:53 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-11-11 23:02:40 +01:00
|
|
|
##
|
|
|
|
# usage: find_cached_package( $pkgname, $pkgver, $arch )
|
|
|
|
#
|
|
|
|
# $pkgver can be supplied with or without a pkgrel appended.
|
|
|
|
# If not supplied, any pkgrel will be matched.
|
|
|
|
##
|
|
|
|
find_cached_package() {
|
2015-02-13 15:17:00 +01:00
|
|
|
local searchdirs=("$PWD" "$PKGDEST") results=()
|
|
|
|
local targetname=$1 targetver=$2 targetarch=$3
|
|
|
|
local dir pkg pkgbasename pkgparts name ver rel arch size r results
|
2014-11-11 23:02:40 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
for dir in "${searchdirs[@]}"; do
|
|
|
|
[[ -d $dir ]] || continue
|
2014-11-11 23:02:40 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
for pkg in "$dir"/*.pkg.tar.xz; do
|
|
|
|
[[ -f $pkg ]] || continue
|
2014-11-11 23:02:40 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
# avoid adding duplicates of the same inode
|
|
|
|
for r in "${results[@]}"; do
|
|
|
|
[[ $r -ef $pkg ]] && continue 2
|
|
|
|
done
|
2014-11-11 23:02:40 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
# split apart package filename into parts
|
|
|
|
pkgbasename=${pkg##*/}
|
|
|
|
pkgbasename=${pkgbasename%.pkg.tar?(.?z)}
|
2014-11-11 23:02:40 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
arch=${pkgbasename##*-}
|
|
|
|
pkgbasename=${pkgbasename%-"$arch"}
|
2014-11-11 23:02:40 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
rel=${pkgbasename##*-}
|
|
|
|
pkgbasename=${pkgbasename%-"$rel"}
|
2014-11-11 23:02:40 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
ver=${pkgbasename##*-}
|
|
|
|
name=${pkgbasename%-"$ver"}
|
2014-11-11 23:02:40 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ $targetname = "$name" && $targetarch = "$arch" ]] &&
|
|
|
|
pkgver_equal "$targetver" "$ver-$rel"; then
|
|
|
|
results+=("$pkg")
|
|
|
|
fi
|
|
|
|
done
|
2014-11-11 23:02:40 +01:00
|
|
|
done
|
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
case ${#results[*]} in
|
|
|
|
0)
|
2014-11-11 23:02:40 +01:00
|
|
|
return 1
|
2015-02-13 15:17:00 +01:00
|
|
|
;;
|
|
|
|
1)
|
2014-11-11 23:02:40 +01:00
|
|
|
printf '%s\n' "$results"
|
|
|
|
return 0
|
2015-02-13 15:17:00 +01:00
|
|
|
;;
|
|
|
|
*)
|
2014-11-11 23:02:40 +01:00
|
|
|
error 'Multiple packages found:'
|
|
|
|
printf '\t%s\n' "${results[@]}" >&2
|
|
|
|
return 1
|
2015-02-13 15:17:00 +01:00
|
|
|
;;
|
|
|
|
esac
|
2014-11-11 23:02:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
##
|
|
|
|
# usage: pkgver_equal( $pkgver1, $pkgver2 )
|
|
|
|
##
|
|
|
|
pkgver_equal() {
|
|
|
|
local left right
|
|
|
|
|
|
|
|
if [[ $1 = *-* && $2 = *-* ]]; then
|
|
|
|
# if both versions have a pkgrel, then they must be an exact match
|
|
|
|
[[ $1 = "$2" ]]
|
2014-10-08 00:11:53 +02:00
|
|
|
else
|
2014-11-11 23:02:40 +01:00
|
|
|
# otherwise, trim any pkgrel and compare the bare version.
|
|
|
|
[[ ${1%%-*} = "${2%%-*}" ]]
|
2014-10-08 00:11:53 +02:00
|
|
|
fi
|
|
|
|
}
|
2014-11-12 02:19:58 +01:00
|
|
|
|
|
|
|
check_root() {
|
2015-02-13 15:17:00 +01:00
|
|
|
(( EUID == 0 )) && return
|
|
|
|
if type -P sudo >/dev/null; then
|
|
|
|
exec sudo -- "$@"
|
|
|
|
else
|
|
|
|
exec su root -c "$(printf ' %q' "$@")"
|
|
|
|
fi
|
2014-11-12 02:19:58 +01:00
|
|
|
}
|
|
|
|
|
2014-11-13 00:19:49 +01:00
|
|
|
load_vars() {
|
2015-02-13 15:17:00 +01:00
|
|
|
local var
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
[[ -f $1 ]] || return 1
|
2014-11-13 00:19:49 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER CARCH GPGKEY; do
|
|
|
|
[[ -z ${!var} ]] && eval $(grep "^${var}=" "$1")
|
|
|
|
done
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
return 0
|
2014-11-13 00:19:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
load_config(){
|
2014-12-08 22:16:06 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
[[ -f $1 ]] || return 1
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
manjaro_tools_conf="$1"
|
2014-11-13 00:19:49 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
[[ -r ${manjaro_tools_conf} ]] && source ${manjaro_tools_conf}
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
######################
|
|
|
|
# common
|
|
|
|
######################
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${branch} ]];then
|
|
|
|
branch='stable'
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${arch} ]]; then
|
|
|
|
arch=$(uname -m)
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${cache_dir} ]];then
|
|
|
|
cache_dir='/var/cache/manjaro-tools'
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
###################
|
|
|
|
# buildtree
|
|
|
|
###################
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${repo_tree} ]];then
|
|
|
|
repo_tree=(core extra community multilib openrc)
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${host_tree} ]];then
|
|
|
|
host_tree='https://github.com/manjaro'
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${host_tree_abs} ]];then
|
2015-02-17 19:07:56 +01:00
|
|
|
host_tree_abs='https://projects.archlinux.org/git/svntogit'
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
###################
|
|
|
|
# buildpkg
|
|
|
|
###################
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${chroots_pkg} ]];then
|
|
|
|
chroots_pkg='/opt/buildpkg'
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${sets_dir_pkg} ]];then
|
|
|
|
sets_dir_pkg="${SYSCONFDIR}/sets/pkg"
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${buildset_pkg} ]];then
|
|
|
|
buildset_pkg='default'
|
|
|
|
fi
|
2015-01-13 13:41:28 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${build_mirror} ]];then
|
|
|
|
build_mirror='http://mirror.netzspielplatz.de/manjaro/packages'
|
|
|
|
fi
|
2015-01-25 18:17:04 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${blacklist_trigger[@]} ]];then
|
|
|
|
blacklist_trigger=('eudev' 'upower-pm-utils' 'eudev-systemdcompat')
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${blacklist[@]} ]];then
|
|
|
|
blacklist=('libsystemd')
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
###################
|
|
|
|
# buildiso
|
|
|
|
###################
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${chroots_iso} ]];then
|
|
|
|
chroots_iso='/opt/buildiso'
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${sets_dir_iso} ]];then
|
|
|
|
sets_dir_iso="${SYSCONFDIR}/sets/iso"
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${buildset_iso} ]];then
|
|
|
|
buildset_iso='default'
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-03-02 23:35:15 +01:00
|
|
|
##### iso settings #####
|
|
|
|
|
2015-03-05 10:54:09 +01:00
|
|
|
if [[ -z ${dist_release} ]];then
|
2015-02-13 15:17:00 +01:00
|
|
|
source /etc/lsb-release
|
2015-03-05 10:54:09 +01:00
|
|
|
dist_release=${DISTRIB_RELEASE}
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2014-12-03 22:59:30 +01:00
|
|
|
|
2015-03-05 10:54:09 +01:00
|
|
|
if [[ -z ${dist_codename} ]];then
|
2015-03-02 23:35:15 +01:00
|
|
|
source /etc/lsb-release
|
2015-03-05 10:54:09 +01:00
|
|
|
dist_codename="${DISTRIB_CODENAME}"
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2014-12-03 22:59:30 +01:00
|
|
|
|
2015-03-05 10:54:09 +01:00
|
|
|
if [[ -z ${dist_branding} ]];then
|
|
|
|
dist_branding="MJRO"
|
2015-03-02 23:35:15 +01:00
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-03-05 10:54:09 +01:00
|
|
|
if [[ -z ${dist_version} ]];then
|
|
|
|
dist_version=$(date +%Y.%m)
|
2015-03-02 23:35:15 +01:00
|
|
|
fi
|
|
|
|
|
2015-03-05 10:54:09 +01:00
|
|
|
if [[ -z ${dist_name} ]];then
|
|
|
|
dist_name="Manjaro"
|
2015-02-20 00:46:43 +01:00
|
|
|
fi
|
2015-03-03 19:39:53 +01:00
|
|
|
|
2015-03-05 10:54:09 +01:00
|
|
|
if [[ -z ${iso_name} ]];then
|
|
|
|
iso_name="manjaro"
|
2015-03-03 12:39:27 +01:00
|
|
|
fi
|
2015-03-03 19:39:53 +01:00
|
|
|
|
2015-03-05 10:54:09 +01:00
|
|
|
iso_label="${dist_branding}${dist_release//.}"
|
2015-03-06 19:07:54 +01:00
|
|
|
iso_label="${iso_label//_}" # relace all _
|
|
|
|
iso_label="${iso_label//-}" # relace all -
|
|
|
|
iso_label="${iso_label^^}" # all uppercase
|
|
|
|
iso_label="${iso_label::8}" # limit to 8 characters
|
2015-03-05 10:54:09 +01:00
|
|
|
|
|
|
|
if [[ -z ${iso_compression} ]];then
|
|
|
|
iso_compression=xz
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-03-05 10:54:09 +01:00
|
|
|
if [[ -z ${iso_checksum} ]];then
|
|
|
|
iso_checksum='md5'
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-03-02 23:35:15 +01:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
load_profile_config(){
|
|
|
|
|
|
|
|
[[ -f $1 ]] || return 1
|
|
|
|
|
|
|
|
profile_conf="$1"
|
|
|
|
|
|
|
|
[[ -r ${profile_conf} ]] && source ${profile_conf}
|
|
|
|
|
2015-03-05 10:54:09 +01:00
|
|
|
if [[ -z ${kernel} ]];then
|
|
|
|
kernel="linux319"
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-03-02 23:35:15 +01:00
|
|
|
if [[ -z ${efi_boot_loader} ]];then
|
|
|
|
efi_boot_loader="grub"
|
|
|
|
fi
|
|
|
|
|
2015-05-06 21:05:12 +02:00
|
|
|
if [[ -z ${efi_part_size} ]]; then
|
2015-05-06 21:48:15 +02:00
|
|
|
efi_part_size="32M"
|
2015-05-06 21:05:12 +02:00
|
|
|
fi
|
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${hostname} ]];then
|
|
|
|
hostname="manjaro"
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${username} ]];then
|
|
|
|
username="manjaro"
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${plymouth_theme} ]];then
|
2015-03-05 10:54:09 +01:00
|
|
|
plymouth_theme="manjaro-elegant"
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${password} ]];then
|
|
|
|
password="manjaro"
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${addgroups} ]];then
|
2015-02-14 00:27:01 +01:00
|
|
|
addgroups="video,audio,power,disk,storage,optical,network,lp,scanner,wheel"
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2014-12-17 02:14:15 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${start_systemd} ]];then
|
|
|
|
start_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${start_openrc} ]];then
|
2015-03-03 19:39:53 +01:00
|
|
|
start_openrc=('acpid' 'bluetooth' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${start_systemd_live} ]];then
|
|
|
|
start_systemd_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -z ${start_openrc_live} ]];then
|
|
|
|
start_openrc_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-03-02 23:35:15 +01:00
|
|
|
if [[ -z ${initsys} ]];then
|
|
|
|
initsys="systemd"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z ${displaymanager} ]];then
|
|
|
|
displaymanager="none"
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
return 0
|
2014-12-08 22:16:06 +01:00
|
|
|
}
|
2015-01-11 21:09:01 +01:00
|
|
|
|
2015-02-16 19:07:19 +01:00
|
|
|
prepare_dir(){
|
|
|
|
[[ ! -d $1 ]] && mkdir -p $1
|
|
|
|
}
|
|
|
|
|
2015-02-16 20:32:47 +01:00
|
|
|
clean_dir(){
|
|
|
|
if [[ -d $1 ]]; then
|
|
|
|
msg "Cleaning [$1] ..."
|
|
|
|
rm -r $1/*
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-01-14 22:29:46 +01:00
|
|
|
# $1: sets_dir
|
2015-01-11 21:09:01 +01:00
|
|
|
load_sets(){
|
2015-02-13 15:17:00 +01:00
|
|
|
local prof temp
|
|
|
|
for item in $(ls $1/*.set); do
|
|
|
|
temp=${item##*/}
|
|
|
|
prof=${prof:-}${prof:+|}${temp%.set}
|
|
|
|
done
|
|
|
|
echo $prof
|
2015-01-11 21:09:01 +01:00
|
|
|
}
|
2015-01-13 13:41:28 +01:00
|
|
|
|
2015-01-29 05:12:17 +01:00
|
|
|
# $1: buildset
|
|
|
|
# $2: sets_dir
|
2015-01-14 22:29:46 +01:00
|
|
|
eval_buildset(){
|
2015-02-13 15:17:00 +01:00
|
|
|
eval "case $1 in
|
|
|
|
$(load_sets $2)) is_buildset=true ;;
|
|
|
|
*) is_buildset=false ;;
|
2015-01-14 22:29:46 +01:00
|
|
|
esac"
|
|
|
|
}
|
|
|
|
|
2015-01-13 13:41:28 +01:00
|
|
|
load_user_info(){
|
2015-02-13 15:17:00 +01:00
|
|
|
OWNER=${SUDO_USER:-$USER}
|
2015-01-13 13:41:28 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
if [[ -n $SUDO_USER ]]; then
|
|
|
|
eval "USER_HOME=~$SUDO_USER"
|
|
|
|
else
|
|
|
|
USER_HOME=$HOME
|
|
|
|
fi
|
2015-02-09 23:38:12 +01:00
|
|
|
|
2015-02-13 15:17:00 +01:00
|
|
|
USER_CONFIG="$USER_HOME/.config"
|
2015-01-13 13:41:28 +01:00
|
|
|
}
|
2015-02-14 10:49:16 +01:00
|
|
|
|
|
|
|
# $1: file
|
|
|
|
# $2: exit code
|
|
|
|
check_sanity(){
|
|
|
|
if [[ ! -f $1 ]]; then
|
|
|
|
eval "$2"
|
|
|
|
fi
|
|
|
|
}
|