make_torrents.sh: review for integration with Mottainai
This commit is contained in:
+32
-28
@@ -3,37 +3,41 @@
|
||||
/usr/sbin/env-update
|
||||
. /etc/profile
|
||||
|
||||
# Path to molecules.git dir
|
||||
SABAYON_MOLECULE_HOME="${SABAYON_MOLECULE_HOME:-/sabayon}"
|
||||
# Path to molecules.git dir. I try to use SABAYON_MOLECULES_DIR from sabayon_molecules.sh script.
|
||||
SABAYON_MOLECULE_HOME="${SABAYON_MOLECULES_DIR:-${SABAYON_MOLECULE_HOME:-/sabayon}}"
|
||||
export SABAYON_MOLECULE_HOME
|
||||
|
||||
announce_url="http://torrents.sabayon.org:8082/announce"
|
||||
iso_dirs=(
|
||||
"${SABAYON_MOLECULE_HOME}/iso"
|
||||
)
|
||||
SABAYON_TORRENT_ANNOUNCE_URL="${SABAYON_TORRENT_ANNOUNCE_URL:-http://torrents.sabayon.org:8082/announce}"
|
||||
|
||||
for iso_dir in "${iso_dirs[@]}"; do
|
||||
cd "${iso_dir}" || exit 1
|
||||
# Use SABAYON_MOLECULES_ISO from sabayon_molecules.sh script (docker-isobuilder)
|
||||
SABAYON_MOLECULES_ISO="${SABAYON_MOLECULES_ISO:-${SABAYON_MOLECULE_HOME}/iso}"
|
||||
|
||||
for iso_file in "${iso_dir}"/*.{iso,tar.gz,tar.xz}; do
|
||||
if [ ! -e "${iso_file}" ]; then
|
||||
echo "${iso_file} does not exist, skipping..."
|
||||
continue
|
||||
fi
|
||||
iso_name="${iso_file/.iso}"
|
||||
iso_name="${iso_name/.tar.gz}"
|
||||
iso_name="${iso_name/.tar.xz}"
|
||||
echo "==========================================================="
|
||||
echo "Torrent Announce URL: ${SABAYON_TORRENT_ANNOUNCE_URL}"
|
||||
echo "==========================================================="
|
||||
|
||||
# do not make torrents for DAILY iso images
|
||||
is_daily=$(echo ${iso_name} | grep DAILY)
|
||||
if [ -n "${is_daily}" ]; then
|
||||
continue
|
||||
fi
|
||||
pushd ${SABAYON_MOLECULES_ISO}
|
||||
|
||||
torrent_file="${iso_file}.torrent"
|
||||
[[ -f "${torrent_file}" ]] && rm "${torrent_file}"
|
||||
iso_file_name="$(basename ${iso_file})"
|
||||
echo "Cooking ${iso_file_name}"
|
||||
mktorrent-borg -pub -nd -a "${announce_url}" -n "${iso_name}" -o "${torrent_file}" "${iso_file_name}" || exit 1
|
||||
done
|
||||
done
|
||||
for iso_file in ${SABAYON_MOLECULES_ISO}/*.{iso,tar.gz,tar.xz}; do
|
||||
|
||||
if [ ! -e "${iso_file}" ]; then
|
||||
echo "${iso_file} does not exist, skipping..."
|
||||
continue
|
||||
fi
|
||||
|
||||
iso_name="${iso_file/.iso}"
|
||||
iso_name="${iso_name/.tar.gz}"
|
||||
iso_name="${iso_name/.tar.xz}"
|
||||
|
||||
torrent_file="${iso_file}.torrent"
|
||||
[[ -f "${torrent_file}" ]] && rm "${torrent_file}"
|
||||
iso_file_name="$(basename ${iso_file})"
|
||||
echo "Cooking ${iso_file_name}"
|
||||
mktorrent-borg -pub -nd \
|
||||
-a "${SABAYON_TORRENT_ANNOUNCE_URL}" -n "${iso_name}" \
|
||||
-o "${torrent_file}" "${iso_file_name}" || exit 1
|
||||
done
|
||||
|
||||
popd
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user