sxmo-utils/setup_config_version.sh

30 lines
385 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
case "$1" in
*.json)
# we ignore json files
exit
esac
case "$(head -n1 "$1")" in
"#"*)
comment="#"
;;
!*)
comment="!"
;;
--*)
comment="--"
;;
*)
exit # we skip this file
;;
esac
md5sum "$1" | \
cut -d" " -f1 | \
xargs -I{} sed -i "2i$comment configversion: {}" \
"$1"