hak.xwx.moe/pretigu_bildosignojn.sh
Jaidyn Ann 62367ed884 Aldonas helposkripton, kiu instalas bildosignojn
… ekzemple, el la datumoj de jam.xwx.moe!
Kiel mi faras. =w=
2024-01-30 17:05:00 -06:00

50 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
#―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
# Name:
# Desc:
# Reqs:
# Date:
#―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
uzado() {
echo "uzado: $(basename "$0") BILDODOSIERO [… BILDODOSIERO]"
echo ""
echo "Tiu ĉi skripto instalas bildodosierojn parametrajn al agordo"
echo "de Forgejo-servilo."
}
if test "$1" = "-h" -o "$1" = "--help" -o -z "$1"; then
1>&2 uzado
if test -z "$1"; then
exit 2
else
exit 0
fi
fi
bildosignoj=""
mkdir -p custom/public/assets/img/emoji/ 2> /dev/null
for bildosigno in $@; do
if test -f "$bildosigno"; then
cp "$bildosigno" custom/public/assets/img/emoji/
if test -n "$bildosignoj"; then
bildosignoj="$bildosignoj,"
fi
bildosignoj="$bildosignoj $(basename "$bildosigno" | sed 's%\..*%%')"
fi
done
if test -n "$bildosignoj"; then
mkdir -p custom/conf/ 2> /dev/null
if grep "CUSTOM_EMOJI" custom/conf/app.ini 2> /dev/null; then
sed -i "s%^CUSTOM_EMOJI.*%CUSTOM_EMOJIS = $bildosignoj%" custom/conf/app.ini
else
printf '\n[ui]\n' \
>> custom/conf/app.ini
echo "CUSTOM_EMOJIS = $bildosignoj" \
>> custom/conf/app.ini
fi
fi