Commit a960d9fb authored by ZappeL's avatar ZappeL
Browse files

Merge branch 'do_update' into 'master'

done: do_update

See merge request !1
parents 9fb85edb a12ff69f
......@@ -2,9 +2,9 @@
# Copyright 2005-2019 Gentoo Foundation
# Distributed under the terms of the GNU GPL version 2 or later
DESCRIPTION="Creates symlinks for valac and vapigen"
DESCRIPTION="Create symlinks for vala and its tools"
MAINTAINER="zappel@simple-co.de"
VERSION="20190919"
VERSION="20190920"
# find a list of symlink targets
find_targets() {
......@@ -29,7 +29,7 @@ set_symlink() {
fi
[[ -z ${target} || ! -f ${EROOT}/usr/bin/${target} ]] \
&& die -q "Target \"${2}\" doesn't appear to be valid!"
&& die -q "Target \"${2}\" for \"${1}\" doesn't appear to be valid!"
ln -s "${target}" "${EROOT}/usr/bin/${1}"
}
......@@ -43,7 +43,7 @@ describe_show() {
do_show() {
write_list_start "Current symlinks:"
for bin in {valac,vapigen}; do
for bin in {vala,valac,vapigen,vala-gen-introspect}; do
if [[ -L "${EROOT}/usr/bin/${bin}" ]]; then
local link=$(canonicalise "${EROOT}/usr/bin/${bin}")
write_kv_list_entry "${link%/}" ""
......@@ -60,13 +60,13 @@ describe_list() {
}
do_list() {
# list uses valac only
local i targets=( $(find_targets valac) )
# list uses vala only
local i targets=( $(find_targets vala) )
write_list_start "Available symlink targets:"
for (( i = 0; i < ${#targets[@]}; i++ )); do
[[ ${targets[i]} = \
$(basename "$(canonicalise "${EROOT}/usr/bin/valac")") ]] \
$(basename "$(canonicalise "${EROOT}/usr/bin/vala")") ]] \
&& targets[i]=$(highlight_marker "${targets[i]}")
done
write_numbered_list -m "(none found)" "${targets[@]}"
......@@ -90,7 +90,7 @@ do_set() {
[[ -z ${1} ]] && die -q "You didn't tell me what to set the symlink to"
[[ $# -gt 1 ]] && die -q "Too many parameters"
for bin in {valac,vapigen}; do
for bin in {vala,valac,vapigen,vala-gen-introspect}; do
if [[ -L ${EROOT}/usr/bin/${bin} ]]; then
remove_symlink "${bin}" || die -q "Couldn't remove existing symlink"
set_symlink "${bin}" "${1}" || die -q "Couldn't set a new symlink"
......@@ -101,3 +101,25 @@ do_set() {
fi
done
}
### update actaion ###
describe_update() {
echo "Updates to the latest version of vala"
}
do_update() {
local i targets=( $(find_targets vala) )
target=${targets[-1]}
for bin in {vala,valac,vapigen,vala-gen-introspect}; do
if [[ -L ${EROOT}/usr/bin/${bin} ]]; then
remove_symlink "${bin}" || die -q "Couldn't remove existing symlink"
set_symlink "${bin}" "${target}" || die -q "Couldn't set a new symlink"
elif [[ -e ${EROOT}/usr/bin/${bin} ]]; then
die -q "${EROOT}/usr/bin/${bin} exists but is not a symlink"
else
set_symlink "${bin}" "${target}" || die -q "Couldn't set a new symlink"
fi
done
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment