jq replaced by yq
This commit is contained in:
+1
-3
@@ -1,8 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
CURDIR=$PWD
|
||||
# shellcheck disable=SC1091
|
||||
# REQUIRED_PKGS=(jq rsync file git)
|
||||
REQUIRED_PKGS=(file git)
|
||||
|
||||
function usage() {
|
||||
@@ -72,7 +70,7 @@ function install_containers() {
|
||||
|
||||
# install inside active LXC containers
|
||||
if [[ -f '/snap/bin/lxc' ]]; then
|
||||
for container in $(/snap/bin/lxc list --format=json | /bin/jq -r '.[] | select(.state.status == "Running") | .name'); do
|
||||
for container in $(/snap/bin/lxc list --format=json | yq '.[] | select(.state.status == "Running") | .name' -); do
|
||||
install_one_container $container
|
||||
echo
|
||||
done
|
||||
|
||||
@@ -5,7 +5,7 @@ if [[ -d /opt/debian-bash ]]; then
|
||||
fi
|
||||
remote_release=$(wget_semver artcode pvincent/debian-bash)
|
||||
|
||||
if [[ $local_release != $remote_release ]];then
|
||||
if [[ $local_release != $remote_release ]]; then
|
||||
echo "upgrading from <$local_release> to <$remote_release> ..."
|
||||
curl https://git.artcode.re/pvincent/debian-bash/raw/master/install.sh | sudo bash -s -- --full
|
||||
else
|
||||
@@ -14,9 +14,9 @@ else
|
||||
# install inside active LXC containers
|
||||
if [[ -f '/snap/bin/lxc' ]]; then
|
||||
echo "refreshing containers ..."
|
||||
for container in `lxc list --format=json | jq -r '.[] | select(.state.status == "Running") | .name'`; do
|
||||
for container in $(lxc list --format=json | yq '.[] | select(.state.status == "Running") | .name' -); do
|
||||
container_release=$(lxc exec $container -- cat /opt/debian-bash/.semver_git_tag)
|
||||
if [[ $container_release != $remote_release ]];then
|
||||
if [[ $container_release != $remote_release ]]; then
|
||||
echo "upgrade container <$container> from <$container_release> to <$remote_release>"
|
||||
/snap/bin/lxc file push /opt/debian-bash "${container}/opt/" -r
|
||||
else
|
||||
@@ -25,4 +25,4 @@ else
|
||||
done
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
function usage() {
|
||||
echo 'usage: --major | -M | --minor | -m | --patch | -p'
|
||||
exit 1
|
||||
@@ -34,8 +33,6 @@ function setCommand() {
|
||||
|
||||
############# main
|
||||
|
||||
|
||||
|
||||
# check git covered
|
||||
REPOSITORY=$(git config --get remote.origin.url)
|
||||
if [[ "$?" -ne 0 ]]; then
|
||||
@@ -131,13 +128,13 @@ GIT_ROOT_FOLDER=$(dirname $(git rev-parse --git-dir))
|
||||
if [[ -f "${GIT_ROOT_FOLDER}/package.json" ]]; then
|
||||
|
||||
echo "package.json detected, version replaced with new tag <${TAG}>"
|
||||
if ! command -v jq &>/dev/null; then
|
||||
echo 'command <jq> not found, hint: `sudo apt install jq`'
|
||||
if ! command -v yq &>/dev/null; then
|
||||
echo 'command <yq> not found, hint: go and fetch latest release from https://github.com/mikefarah/yq'
|
||||
exit 5
|
||||
fi
|
||||
|
||||
tmp=$(mktemp)
|
||||
jq '.version = $TAG' --arg TAG $TAG "${GIT_ROOT_FOLDER}/package.json" >"$tmp" && mv "$tmp" "${GIT_ROOT_FOLDER}/package.json"
|
||||
yq ".version = $TAG" "${GIT_ROOT_FOLDER}/package.json" >"$tmp" && mv "$tmp" "${GIT_ROOT_FOLDER}/package.json"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user