Compare commits
8 Commits
71cdccbeae
...
dev
Author | SHA1 | Date | |
---|---|---|---|
d809533280 | |||
ee367f9b3f | |||
d673eb2f6a | |||
afac80d543 | |||
f090607f67 | |||
1dccb10a45 | |||
6f7934f8ff | |||
998f5ed338 |
@ -131,13 +131,15 @@ function build_album_pages {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
## Put in the subpage HTML ##
|
## Put in the subpage HTML ##
|
||||||
# Set the count if this is the first loop.
|
new_row="\t\t<div class='row text'>"
|
||||||
|
# Set the count and start a row if this is the first loop.
|
||||||
if [[ -z $count ]]; then
|
if [[ -z $count ]]; then
|
||||||
count=0
|
count=0
|
||||||
fi
|
echo -e "$newrow" >> $subpage
|
||||||
# Add a row for the next 2 images.
|
# Else check if we need to start a new one for the next 2 images.
|
||||||
if (( $count % 2 == 0 )); then
|
elif (( $count % 2 == 0 )); then
|
||||||
echo -e "\t\t<div class='row text'>" >> $subpage
|
echo -e "\t\t</div>" >> $subpage
|
||||||
|
echo -e "$newrow" >> $subpage
|
||||||
fi
|
fi
|
||||||
# Add the container for the image and its text.
|
# Add the container for the image and its text.
|
||||||
echo -e "\t\t\t<div class='col-6 center'>" >> $subpage
|
echo -e "\t\t\t<div class='col-6 center'>" >> $subpage
|
||||||
@ -160,10 +162,6 @@ function build_album_pages {
|
|||||||
fi
|
fi
|
||||||
# Close the image description and its link.
|
# Close the image description and its link.
|
||||||
echo -e "</p>\n\t\t\t\t</a>\n\t\t\t</div>" >> $subpage
|
echo -e "</p>\n\t\t\t\t</a>\n\t\t\t</div>" >> $subpage
|
||||||
# Close the row after an odd count.
|
|
||||||
if (( $count % 2 == 1 )); then
|
|
||||||
echo -e "\t\t</div>" >> $subpage
|
|
||||||
fi
|
|
||||||
count=$(( count + 1 ))
|
count=$(( count + 1 ))
|
||||||
done
|
done
|
||||||
echo -e "\t\t</div>" >> $subpage
|
echo -e "\t\t</div>" >> $subpage
|
||||||
@ -249,7 +247,8 @@ function build_all_page {
|
|||||||
count=0
|
count=0
|
||||||
fi
|
fi
|
||||||
if [[ $count == 0 ]]; then
|
if [[ $count == 0 ]]; then
|
||||||
echo -e "\t\t<div class=row text>" >> $allpage
|
echo -e "\t\t</div>" >> $allpage
|
||||||
|
echo -e "\t\t<div class='row text'>" >> $allpage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add a column.
|
# Add a column.
|
||||||
@ -291,10 +290,16 @@ function build_all_page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
## Main ##
|
## Main ##
|
||||||
|
beg_time="$SECONDS"
|
||||||
|
|
||||||
start_main_page
|
start_main_page
|
||||||
build_album_pages
|
build_album_pages
|
||||||
build_all_page
|
build_all_page
|
||||||
end_main_page
|
end_main_page
|
||||||
|
|
||||||
|
end_time="$SECONDS"
|
||||||
|
time="$(( $end_time - $beg_time ))"
|
||||||
|
echo "<!-- Script took '$time' seconds to process. -->" >> $mainpage
|
||||||
|
|
||||||
cat $mainpage
|
cat $mainpage
|
||||||
exit 0
|
exit 0
|
||||||
|
10
run.sh
10
run.sh
@ -51,6 +51,9 @@ fi
|
|||||||
cd $DIR
|
cd $DIR
|
||||||
|
|
||||||
sudo=""
|
sudo=""
|
||||||
|
if [[ -z $LOGNAME ]]; then
|
||||||
|
LOGNAME="`whoami`"
|
||||||
|
fi
|
||||||
if [[ $LOGNAME != "root" ]]; then
|
if [[ $LOGNAME != "root" ]]; then
|
||||||
log "Using sudo since user is '$LOGNAME'."
|
log "Using sudo since user is '$LOGNAME'."
|
||||||
sudo="sudo"
|
sudo="sudo"
|
||||||
@ -70,7 +73,7 @@ if [[ ! `which npm` ]]; then
|
|||||||
$sudo apt-get install -y npm
|
$sudo apt-get install -y npm
|
||||||
fi
|
fi
|
||||||
if [[ ! `which curl` ]]; then
|
if [[ ! `which curl` ]]; then
|
||||||
echo "- Installing NPM"
|
echo "- Installing Curl"
|
||||||
$sudo apt-get install -y curl
|
$sudo apt-get install -y curl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -96,6 +99,7 @@ find files/photos/ -name "*".html -print -delete
|
|||||||
http_code=0
|
http_code=0
|
||||||
port="${ports%% *}"
|
port="${ports%% *}"
|
||||||
photos_uri=":$port/photos/"
|
photos_uri=":$port/photos/"
|
||||||
|
beg_time="$SECONDS"
|
||||||
while [[ $http_code != "200" ]]; do
|
while [[ $http_code != "200" ]]; do
|
||||||
log "Sleeping for '$count' while waiting for $photos_uri to come up."
|
log "Sleeping for '$count' while waiting for $photos_uri to come up."
|
||||||
sleep $count
|
sleep $count
|
||||||
@ -109,7 +113,9 @@ find files/photos/ -name "*".html -print -delete
|
|||||||
count=$(( count + 1 ))
|
count=$(( count + 1 ))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
log "Finished checking for /photos/."
|
end_time="$SECONDS"
|
||||||
|
time="$(( $end_time - $beg_time ))"
|
||||||
|
log "Finished checking for /photos/ after '$time' seconds."
|
||||||
} &
|
} &
|
||||||
|
|
||||||
## Main ##
|
## Main ##
|
||||||
|
Reference in New Issue
Block a user