chore: Add a builder script

This commit is contained in:
Carlos Solís 2025-02-06 15:00:17 +00:00
parent a4a4194f41
commit f3ee8fabc6
3 changed files with 22 additions and 7 deletions

16
copy.sh Normal file
View file

@ -0,0 +1,16 @@
#!/bin/bash
for i in ./*.sh; do
shfmt -w "${i}"
shellcheck -o all -f diff "${i}" | patch -p1
i_tmp="${i##./}"
find /etc/cron.* -iname "${i_tmp%.sh}" | while read -r j; do
echo "${j}"
diff <(sed -e "s/friendica.example.net/hub.azkware.net/g" -e "s/#&>/\&\>/g" "${i}") "${j}"
sed -e "s/friendica.example.net/hub.azkware.net/g" -e "s/#&>/\&\>/g" "${i}" | sudo tee "${j}" &>/dev/null
done
find ../../Scripts -iname "${i_tmp}" | while read -r k; do
echo "${k}"
diff <(sed -e "s/friendica.example.net/hub.azkware.net/g" "${i}") "${k}"
sed -e "s/friendica.example.net/hub.azkware.net/g" "${i}" | sudo tee "${k}" &>/dev/null
done
done

View file

@ -282,7 +282,6 @@ until [[ "${tmp_item_uri_not_valid_q}" -lt "${limit}" ]]; do
AND NOT EXISTS ( SELECT \`thr-parent-id\` FROM \`mail\` WHERE \`thr-parent-id\` = \`item-uri\`.\`id\` ) \
ORDER BY \`id\` LIMIT ${limit}")
final_i=$(($(date +%s) - initial_i))
echo "${tmp_item_uri_not_valid_q} item(s) deleted until ${tmp_item_uri_not_valid_current_id} in ${final_i}s"
done

View file

@ -76,7 +76,7 @@ until [[ $((nt + limit)) -gt ${dbcount} ]]; do
curl -s "${micro}" | file - | grep -q -e "text" -e "empty" -e "symbolic link" -e "directory"; then
#Request the user data to be regenerated in the system through the database
mariadb "${db}" -N -B -q -e "update contact set avatar= \"\", photo = \"\", thumb = \"\", micro = \"\" where id = \"${id}\""
if [[ $(mariadb "${db}" -N -B -q -e "select count(*) from workerqueue where command = \"UpdateContact\" and parameter = \"[${id}]\"" -gt 0) ]]; then
if [[ -n $(mariadb "${db}" -N -B -q -e "select count(*) from workerqueue where command = \"UpdateContact\" and parameter = \"[${id}]\"" -gt 0) ]]; then
mariadb "${db}" -N -B -q -e "insert ignore into workerqueue (command, parameter, priority, created) values (\"UpdateContact\", \"[${id}]\", 20, CURTIME());"
fi
echo "${id} ${photo}"
@ -103,7 +103,7 @@ until [[ $((nt + limit)) -gt ${dbcount} ]]; do
rm -rf "${k_photo}"
fi
#Request the user data to be regenerated in the system through the database
if [[ $(mariadb "${db}" -N -B -q -e "select count(*) from workerqueue where command = \"UpdateContact\" and parameter = \"[${id}]\"" -gt 0) ]]; then
if [[ -n $(mariadb "${db}" -N -B -q -e "select count(*) from workerqueue where command = \"UpdateContact\" and parameter = \"[${id}]\"" -gt 0) ]]; then
mariadb "${db}" -N -B -q -e "insert ignore into workerqueue (command, parameter, priority, created) values (\"UpdateContact\", \"[${id}]\", 20, CURTIME());"
fi
else
@ -111,7 +111,7 @@ until [[ $((nt + limit)) -gt ${dbcount} ]]; do
#If no remote avatar is found, then we blank the photo/thumb/micro and let the avatar cache process fix them later
mariadb "${db}" -e "update contact set photo = \"\", thumb = \"\", micro = \"\" where id = \"${id}\""
#Request the user data to be regenerated in the system through the database
if [[ $(mariadb "${db}" -N -B -q -e "select count(*) from workerqueue where command = \"UpdateContact\" and parameter = \"[${id}]\"" -gt 0) ]]; then
if [[ -n $(mariadb "${db}" -N -B -q -e "select count(*) from workerqueue where command = \"UpdateContact\" and parameter = \"[${id}]\"" -gt 0) ]]; then
mariadb "${db}" -N -B -q -e "insert ignore into workerqueue (command, parameter, priority, created) values (\"UpdateContact\", \"[${id}]\", 20, CURTIME());"
fi
fi