Add sources support
This commit is contained in:
parent
38614d26f4
commit
46de0ea716
3 changed files with 51 additions and 14 deletions
0
altools/chroot-al
Normal file
0
altools/chroot-al
Normal file
|
@ -6,13 +6,13 @@
|
|||
. /etc/al/config
|
||||
case $1 in
|
||||
# add a repo
|
||||
add) git clone https://${3}/${2}.git ${install_root}/var/aps/repos/${2}
|
||||
add) git clone ${2} ${install_root}/var/db/repos
|
||||
echo "${2}" >> ${install_root}/etc/al/repo.conf
|
||||
;;
|
||||
# update a repo
|
||||
update) pushd && cd ${install_root}/var/aps/repos/${2} && git pull && popd ;;
|
||||
# destroy a repo (remove)
|
||||
destroy) rm -rfv ${install_root}/var/aps/repos/${2}
|
||||
destroy) rm -rfv ${install_root}/var/db/aps/repos/${2}
|
||||
sed -i "/^${2}/d" ${install_root}/etc/al/repo.conf
|
||||
;;
|
||||
esac
|
||||
|
|
61
aps
61
aps
|
@ -18,20 +18,33 @@ function prn(){
|
|||
function wrn(){
|
||||
echo -e "\e[34m==>\e[33m WARNING:\e[39m $1"
|
||||
}
|
||||
function run(){
|
||||
printf '%s\n' "$*"
|
||||
"$@"
|
||||
}
|
||||
#function run(){
|
||||
# printf '%s\n' "$*"
|
||||
# "$@"
|
||||
#}
|
||||
function err(){
|
||||
echo -e "\e[34m==>\e[31m ERROR:\e[39m $1" &&
|
||||
rm ${lock} 2>&1 > /dev/null &&
|
||||
rm ${lock} 2> /dev/null &&
|
||||
exit 2
|
||||
}
|
||||
function notf(){
|
||||
echo -e "\e[34m==>\e[36m NOTIFICATION:\e[39m $1"
|
||||
}
|
||||
function dbg(){
|
||||
wrn "THIS IS A DEBUG TEST BUILD, IT MAY NOT WORK, IT'S GLITCHY AS FUCK!"
|
||||
wrn "This is a debug build, that may not work!"
|
||||
}
|
||||
function sources(){
|
||||
if [ -f sources ]; then
|
||||
pkg_config_url=$(getopt -o hf:gb -1 help,file:,sources)
|
||||
pkg_config_archv=$(echo ${pkg_config_url} | sed 's:.*/::')
|
||||
curl -fLO ${pkg_config_url}
|
||||
mkdir --parents pkgex
|
||||
tar -xvf ${pkg_config_archv} -C pkgex
|
||||
mkdir --parents pkgsrc
|
||||
cp -r pkgex/*/* pkgsrc
|
||||
else
|
||||
err "Sources not found, exiting!"
|
||||
fi
|
||||
}
|
||||
function runbuildsh(){
|
||||
if [ -x "${2}/${1}" ]; then
|
||||
|
@ -61,24 +74,45 @@ function pkg_find(){
|
|||
}
|
||||
function pkg_local(){
|
||||
if [ -z "$AL_REPO" ]; then
|
||||
wrn "Alnux Repo variable is not set, Setting to /var/db/repo/core!"
|
||||
wrn "Alnux Repo variable is not set, setting to /var/db/repo/core!"
|
||||
prn "To set the Alnux Repo var, either:"
|
||||
prn " edit /etc/profile or your shell's profile to include your repo and sub-repos, "
|
||||
prn " much like this: export AL_REPO=/var/db/repo/core:/var/db/repo/extra OR"
|
||||
prn " export Alnux Repo var like this: export AL_REPO=/var/db/repo/core:/var/db/repo/extra"
|
||||
export AL_REPO="/var/db/repo/core"
|
||||
export AL_REPO="/var/aps/repos/official/core"
|
||||
notf "AL_REPO set to /var/db/repo/core"
|
||||
prn "Verifying if AL_REPO is set..."
|
||||
if [ -z $AL_REPO ]; then
|
||||
err "AL_REPO is not set."
|
||||
else
|
||||
prn "$(echo $AL_REPO)... yes."
|
||||
fi
|
||||
|
||||
fi
|
||||
cp -prv "${1}" "${temp_location}"
|
||||
pkg_find $@
|
||||
cp -prv "${1}" "${temp_location}"
|
||||
|
||||
# - - - - - #
|
||||
# VARIABLES #
|
||||
# - - - - - #
|
||||
pkg_name="${1%/}"
|
||||
pkg_name="${pkg_name##*/}"
|
||||
pkg_name=$(echo "${pkg_name}" | cut -f 1 -d '.')
|
||||
# - - - - - - -#
|
||||
# PKG CONFIG #
|
||||
# - - - - - - -#
|
||||
pkg_config_deploy=true
|
||||
pkg_config_ver="0"
|
||||
pkg_config_makedepends=""
|
||||
pkg_config_depends=""
|
||||
|
||||
}
|
||||
function help(){
|
||||
prn "h|help) prints this message"
|
||||
prn "v|version) version"
|
||||
prn "s|sync) install package(s)"
|
||||
prn "s|sync) install package(s), and sync repositories"
|
||||
prn "u|update) update"
|
||||
prn "y|upgrade) upgrade"
|
||||
prn "i|install) install LOCAL package(s)"
|
||||
}
|
||||
function version(){
|
||||
|
@ -87,10 +121,13 @@ function version(){
|
|||
function main(){
|
||||
dbg
|
||||
case $1 in
|
||||
s|sync) pkg_local $@ ;;
|
||||
s|sync) pkg_local ${@: -1} ;;
|
||||
i|install) pkg_local ${@: -1} ;;
|
||||
u|update) update ;;
|
||||
y|upgrade) upgrade ;;
|
||||
v|version) version ;;
|
||||
h|help) help ;;
|
||||
*) err "Invalid option"
|
||||
esac
|
||||
}
|
||||
main $1
|
||||
main $1 ${@: -1}
|
Loading…
Reference in a new issue