diff --git a/bin/buildiso.in b/bin/buildiso.in
index 2ae176b..920e7ef 100755
--- a/bin/buildiso.in
+++ b/bin/buildiso.in
@@ -84,7 +84,7 @@ display_settings(){
msg "ISO INFO:"
msg2 "iso_label: %s" "${iso_label}"
msg2 "iso_compression: %s" "${iso_compression}"
-
+
msg "BUILD QUEUE:"
run show_profile "${build_list_iso}"
}
diff --git a/lib/util-iso.sh b/lib/util-iso.sh
index 394cd81..bf5c3cd 100644
--- a/lib/util-iso.sh
+++ b/lib/util-iso.sh
@@ -204,13 +204,37 @@ make_iso() {
# Sanity checks
[[ ! -d "${iso_root}" ]] && return 1
if [[ -f "${iso_dir}/${iso_file}" ]]; then
- msg2 "Removing existing bootable image..."
- rm -rf "${iso_dir}/${iso_file}"
+ msg2 "Removing ${iso_file} related files ..."
+ [[ -f "${iso_dir}/${iso_file}" ]] && rm -f "${iso_dir}/${iso_file}"
+ [[ -f "${iso_dir}/${iso_file}.sig" ]] && rm -f "${iso_dir}/${iso_file}.sig"
+ [[ -f "${iso_dir}/${iso_file}.sha1" ]] && rm -f "${iso_dir}/${iso_file}.sha1"
+ [[ -f "${iso_dir}/${iso_file}.sha256" ]] && rm -f "${iso_dir}/${iso_file}.sha256"
+ [[ -f "${iso_dir}/${iso_file}.torrent" ]] && rm -f "${iso_dir}/${iso_file}.torrent"
fi
assemble_iso
+
+ [[ ${target_branch} == "stable" ]] && [[ ${extra} == "true" ]] && gen_latest_html
+
msg "Done [Build ISO]"
}
+gen_latest_html(){
+ if [[ ${edition} == "community" ]] || [[ ${edition} == "manjaro" ]]; then
+ if [[ -f "${iso_dir}/${iso_file}" ]]; then
+ msg2 "Creating download link ..."
+ direct_url="https://osdn.net/dl/${edition}/${iso_file}"
+ [[ ${edition} == "community" ]] && direct_url="https://osdn.net/dl/manjaro-${edition}/${iso_file}"
+ html_doc=""
+ html_doc+=""
+ html_doc+=""
+ html_doc+=""
+ html_doc+="
Download Redirection"
+ html_doc+="If you are not redirected automatically, follow the link to latest iso"
+ echo ${html_doc} > "${iso_dir}/.latest"
+ fi
+ fi
+}
+
gen_iso_fn(){
local vars=() name
vars+=("${iso_name}")
@@ -218,7 +242,7 @@ gen_iso_fn(){
[[ -n ${profile} ]] && vars+=("${profile}")
fi
vars+=("${dist_release}")
-
+
[[ ! ${target_branch} == "stable" ]] && vars+=("${target_branch}")
[[ ${extra} == 'false' ]] && vars+=("minimal")
@@ -227,10 +251,11 @@ gen_iso_fn(){
vars+=("${kernel}")
- [[ ${target_arch} == "i686" ]] && vars+=("${target_arch}")
+ [[ ${target_arch} == "i686" ]] && vars+=("${target_arch}")
for n in ${vars[@]}; do
name=${name:-}${name:+-}${n}
done
+
echo $name
}
diff --git a/lib/util-publish.sh b/lib/util-publish.sh
index 9e86854..dda35df 100644
--- a/lib/util-publish.sh
+++ b/lib/util-publish.sh
@@ -15,6 +15,11 @@ connect(){
echo "${account}${storage}${project}"
}
+connect_webserver(){
+ local webserver="@shell.osdn.net:/home/groups/m/ma/"
+ echo "${account}${webserver}${project}"
+}
+
make_torrent(){
find ${src_dir} -type f -name "*.torrent" -delete
@@ -34,7 +39,7 @@ prepare_transfer(){
hidden="$2"
edition=$(get_edition "${profile}")
[[ -z ${project} ]] && project="$(get_project)"
- url=$(connect)
+ server=$(connect)
target_dir="${profile}/${dist_release}"
src_dir="${run_dir}/${edition}/${target_dir}"
@@ -73,16 +78,28 @@ sync_dir(){
${ssh_agent} && ssh_add
msg "Start upload [%s] to [%s] ..." "$1" "${project}"
- while [[ $count -le $max_count ]]; do
- rsync ${rsync_args[*]} ${src_dir}/ ${url}/${target_dir}/
+
+ while [[ $count -le $max_count ]]; do
+ rsync ${rsync_args[*]} --exclude '.latest' ${src_dir}/ ${server}/${target_dir}/
if [[ $? != 0 ]]; then
count=$(($count + 1))
msg "Upload failed. retrying (%s/%s) ..." "$count" "$max_count"
sleep 2
else
count=$(($max_count + 1))
+ [[ -f "${src_dir}/.latest" ]] && sync_latest_html
msg "Done upload [%s]" "$1"
show_elapsed_time "${FUNCNAME}" "${timer_start}"
fi
done
+
+}
+
+sync_latest_html(){
+ msg2 "Sending download link ..."
+ local webserver=$(connect_webserver)
+ local htdocs="htdocs/${profile}"
+ local html="latest"
+ scp "${src_dir}/.${html}" "${webserver}/${htdocs}/${html}"
+ rm -f "${src_dir}/.${html}"
}