mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-25 22:26:21 +00:00
42 lines
1.2 KiB
Text
42 lines
1.2 KiB
Text
|
#!/bin/bash
|
||
|
|
||
|
test -f _sites/.migrated && exit 0
|
||
|
|
||
|
# Crear los directorios donde van las usuarias e invitadxs
|
||
|
mkdir -p _usuarias _invitadxs
|
||
|
|
||
|
# Recorrer todos los sitios
|
||
|
for site in _sites/*/*; do
|
||
|
# Obtener la ubicación real de los sitios
|
||
|
real_site="$(readlink -f "${site}")"
|
||
|
# Obtener el nombre dentro de Sutty
|
||
|
site_name="$(basename "${site}")"
|
||
|
|
||
|
# Mover los directorios a donde van
|
||
|
if ! test -e "_sites/${site_name}" ; then
|
||
|
# Si son symlinks, mantener el symlink, sino mover el directorio
|
||
|
if test -L "${site}" ; then
|
||
|
ln -s "${real_site}" "_sites/${site_name}"
|
||
|
else
|
||
|
mv "${site}" "_sites/${site_name}"
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
for tipo in usuarias invitadxs; do
|
||
|
test -f "${real_site}/.${tipo}" || continue
|
||
|
cat "${real_site}/.${tipo}" | while read usuaria; do
|
||
|
# Crear los directorios de las usuarias y lxs invitadxs
|
||
|
mkdir -p "_${tipo}/${usuaria}"
|
||
|
# Linkear el sitio
|
||
|
ln -s "../../_sites/${site_name}" "_${tipo}/${usuaria}/${site_name}"
|
||
|
done
|
||
|
done
|
||
|
done
|
||
|
|
||
|
# Elimina los directorios de las usuarias e invitadxs
|
||
|
cat _sites/*/.usuarias _sites/*/.invitadxs | while read u; do
|
||
|
rm -rf "_sites/${u}"
|
||
|
done
|
||
|
|
||
|
touch _sites/.migrated
|