freedombone-app-pelican 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Pelican static blog
  12. #
  13. # License
  14. # =======
  15. #
  16. # Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
  17. #
  18. # This program is free software: you can redistribute it and/or modify
  19. # it under the terms of the GNU Affero General Public License as published by
  20. # the Free Software Foundation, either version 3 of the License, or
  21. # (at your option) any later version.
  22. #
  23. # This program is distributed in the hope that it will be useful,
  24. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. # GNU Affero General Public License for more details.
  27. #
  28. # You should have received a copy of the GNU Affero General Public License
  29. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  30. VARIANTS="full full-vim writer"
  31. IN_DEFAULT_INSTALL=0
  32. SHOW_ON_ABOUT=1
  33. PELICAN_DOMAIN_NAME=
  34. PELICAN_BLOG_CODE=
  35. PELICAN_ONION_PORT=8113
  36. PELICAN_THEMES_REPO="https://github.com/getpelican/pelican-themes"
  37. PELICAN_PLUGINS_REPO="https://github.com/getpelican/pelican-plugins"
  38. DEFAULT_BLOG_TITLE=$"Freedombone Blog"
  39. PELICAN_BLOG_INSTALL_DIR=/etc/blog
  40. PELICAN_CURRENT_BLOG_INDEX=$PELICAN_BLOG_INSTALL_DIR/.blog-index
  41. pelican_variables=(MY_USERNAME
  42. ONION_ONLY
  43. PELICAN_DOMAIN_NAME
  44. PELICAN_BLOG_CODE)
  45. function install_pelican_website {
  46. if [[ $ONION_ONLY != 'no' ]]; then
  47. echo -n '' > /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  48. return
  49. fi
  50. function_check nginx_http_redirect
  51. nginx_http_redirect $PELICAN_DOMAIN_NAME
  52. echo 'server {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  53. echo ' listen 443 ssl;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  54. echo ' listen [::]:443 ssl;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  55. echo " root /var/www/${PELICAN_DOMAIN_NAME}/htdocs;" >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  56. echo " server_name ${PELICAN_DOMAIN_NAME};" >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  57. echo ' access_log /dev/null;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  58. echo " error_log /dev/null;" >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  59. echo ' index index.html;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  60. echo ' charset utf-8;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  61. function_check nginx_ssl
  62. nginx_ssl $PELICAN_DOMAIN_NAME
  63. function_check nginx_disable_sniffing
  64. nginx_disable_sniffing $PELICAN_DOMAIN_NAME
  65. echo ' add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  66. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  67. echo ' location / {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  68. function_check nginx_limits
  69. nginx_limits $PELICAN_DOMAIN_NAME
  70. echo ' }' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  71. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  72. nginx_keybase ${PELICAN_DOMAIN_NAME}
  73. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  74. echo ' # block these file types' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  75. echo ' location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  76. echo ' deny all;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  77. echo ' }' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  78. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  79. echo ' # deny access to all dot files' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  80. echo ' location ~ /\. {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  81. echo ' deny all;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  82. echo ' }' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  83. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  84. echo ' location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  85. echo ' deny all;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  86. echo ' }' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  87. echo ' location ~ /\.ht {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  88. echo ' deny all;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  89. echo ' }' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  90. echo '}' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  91. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  92. function_check create_site_certificate
  93. create_site_certificate $PELICAN_DOMAIN_NAME 'yes'
  94. }
  95. function install_pelican_website_onion {
  96. echo 'server {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  97. echo " listen 127.0.0.1:${PELICAN_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  98. echo " root /var/www/${PELICAN_DOMAIN_NAME}/htdocs;" >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  99. echo " server_name ${PELICAN_DOMAIN_NAME};" >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  100. echo ' access_log /dev/null;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  101. echo " error_log /dev/null;" >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  102. echo ' index index.html;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  103. echo ' charset utf-8;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  104. function_check nginx_disable_sniffing
  105. nginx_disable_sniffing $PELICAN_DOMAIN_NAME
  106. echo ' add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  107. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  108. echo ' location / {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  109. function_check nginx_limits
  110. nginx_limits $PELICAN_DOMAIN_NAME
  111. echo ' }' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  112. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  113. nginx_keybase ${PELICAN_DOMAIN_NAME}
  114. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  115. echo ' # block these file types' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  116. echo ' location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  117. echo ' deny all;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  118. echo ' }' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  119. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  120. echo ' # deny access to all dot files' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  121. echo ' location ~ /\. {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  122. echo ' deny all;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  123. echo ' }' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  124. echo '' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  125. echo ' location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  126. echo ' deny all;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  127. echo ' }' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  128. echo ' location ~ /\.ht {' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  129. echo ' deny all;' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  130. echo ' }' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  131. echo '}' >> /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  132. }
  133. function pelican_editor_config {
  134. if [ ! -f $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican ]; then
  135. echo "(add-hook 'before-save-hook 'delete-trailing-whitespace)" > $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  136. echo '(setq org-support-shift-select t)' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  137. echo '(setq standard-indent 4)' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  138. echo '(setq-default tab-width 4)' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  139. echo '(setq c-basic-offset 4)' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  140. echo '(mouse-wheel-mode t)' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  141. echo '(setq make-backup-files t)' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  142. echo '(setq version-control t)' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  143. echo '(setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  144. echo "(setq default-major-mode 'text-mode)" >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  145. echo "(dolist (hook '(text-mode-hook))" >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  146. echo ' (add-hook hook (lambda () (flyspell-mode 1))))' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  147. echo '(setq-default fill-column 72)' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  148. echo '(setq auto-fill-mode 0)' >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  149. echo "(add-hook 'text-mode-hook 'turn-on-auto-fill)" >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  150. echo "(setq-default auto-fill-function 'do-auto-fill)" >> $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican
  151. fi
  152. }
  153. function pelican_regenerate_blog {
  154. clear
  155. echo ''
  156. echo $'Regenerating blog...'
  157. cd $PELICAN_BLOG_INSTALL_DIR
  158. make html
  159. cp -r $PELICAN_BLOG_INSTALL_DIR/output/* /var/www/$PELICAN_DOMAIN_NAME/htdocs/
  160. chown -R www-data:www-data /var/www/$PELICAN_DOMAIN_NAME/htdocs
  161. }
  162. function pelican_new_blog {
  163. DATESTR=$(date "+%Y-%m-%d %H:%M:%S")
  164. if [ ! -f $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry ]; then
  165. echo $'Title: Blog Post Title' > $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  166. echo $"Date: ${DATESTR}" >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  167. echo $"Author: $(toxid --showuser)" >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  168. echo $'Category: default' >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  169. echo $'Tags: blog, tag' >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  170. echo '' >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  171. echo $'Add your text here' >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  172. echo '' >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  173. echo -n $'To include an image copy it into the /etc/blog/content/images directory, ' >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  174. echo $'then link to it with:' >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  175. echo '' >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  176. echo $'![My image]({filename}images/myimage.jpg)' >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  177. echo '' >> $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  178. fi
  179. if [ -f /usr/bin/emacs ]; then
  180. emacs -q --load $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  181. else
  182. editor $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry
  183. fi
  184. if grep -q $"Add your text here" $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry; then
  185. return
  186. fi
  187. if grep -q $"Blog Post Title" $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry; then
  188. return
  189. fi
  190. if [ ! -f $PELICAN_CURRENT_BLOG_INDEX ]; then
  191. echo '0' > $PELICAN_CURRENT_BLOG_INDEX
  192. fi
  193. # move to the content directory
  194. CURRENT_INDEX=$(cat $PELICAN_CURRENT_BLOG_INDEX)
  195. mv $PELICAN_BLOG_INSTALL_DIR/.new-blog-entry $BLOG_CONTENT_PATH/${CURRENT_INDEX}_post.md
  196. # increment the index
  197. CURRENT_INDEX=$((CURRENT_INDEX + 1))
  198. echo "$CURRENT_INDEX" > $PELICAN_CURRENT_BLOG_INDEX
  199. pelican_regenerate_blog
  200. }
  201. function pelican_edit_blog {
  202. if [ ! -f $PELICAN_CURRENT_BLOG_INDEX ]; then
  203. return
  204. fi
  205. CURRENT_INDEX=$(cat $PELICAN_CURRENT_BLOG_INDEX)
  206. PREVIOUS_INDEX=$((CURRENT_INDEX - 1))
  207. LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.md
  208. if [ ! -f $LAST_BLOG_ENTRY ]; then
  209. return
  210. fi
  211. if [ -f /usr/bin/emacs ]; then
  212. emacs -q --load $PELICAN_BLOG_INSTALL_DIR/.emacs-pelican $LAST_BLOG_ENTRY
  213. else
  214. editor $LAST_BLOG_ENTRY
  215. fi
  216. pelican_regenerate_blog
  217. }
  218. function pelican_delete_blog {
  219. if [ ! -f $PELICAN_CURRENT_BLOG_INDEX ]; then
  220. return
  221. fi
  222. CURRENT_INDEX=$(cat $PELICAN_CURRENT_BLOG_INDEX)
  223. PREVIOUS_INDEX=$((CURRENT_INDEX - 1))
  224. LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.md
  225. if [ ! -f $LAST_BLOG_ENTRY ]; then
  226. return
  227. fi
  228. dialog --title $"Delete the previous blog entry" \
  229. --backtitle $"Freedombone Mesh" \
  230. --defaultno \
  231. --yesno $"\nAre you sure that you wish to delete the previous blog entry?" 8 60
  232. sel=$?
  233. case $sel in
  234. 0) rm $LAST_BLOG_ENTRY
  235. if [ $CURRENT_INDEX -gt 0 ]; then
  236. CURRENT_INDEX=$PREVIOUS_INDEX
  237. echo "$CURRENT_INDEX" > $PELICAN_CURRENT_BLOG_INDEX
  238. else
  239. rm -f $PELICAN_CURRENT_BLOG_INDEX
  240. fi
  241. pelican_regenerate_blog
  242. ;;
  243. esac
  244. }
  245. function pelican_change_theme {
  246. THEMES=()
  247. for d in $PELICAN_BLOG_INSTALL_DIR/themes/*/ ; do
  248. THEME_NAME=$(echo "$d" | awk -F '/' '{print $6}')
  249. THEMES+=("$THEME_NAME")
  250. done
  251. themelist=""
  252. n=1
  253. theme_index=0
  254. curr_theme_index=
  255. if [ -f $PELICAN_BLOG_INSTALL_DIR/.blog-theme-index ]; then
  256. curr_theme_index=$(cat $PELICAN_BLOG_INSTALL_DIR/.blog-theme-index)
  257. fi
  258. for a in "${THEMES[@]}"
  259. do
  260. is_selected='off'
  261. if [ $curr_theme_index ]; then
  262. if [ $n -eq $curr_theme_index ]; then
  263. is_selected='on'
  264. fi
  265. else
  266. if [[ "$a" == 'nice-blog' ]]; then
  267. is_selected='on'
  268. fi
  269. fi
  270. themelist="$themelist $n $a $is_selected"
  271. n=$[n+1]
  272. theme_index=$[theme_index+1]
  273. done
  274. data=$(tempfile 2>/dev/null)
  275. trap "rm -f $data" 0 1 2 5 15
  276. dialog --backtitle $"Freedombone Mesh" \
  277. --title $"Select Blog Theme" \
  278. --radiolist $'Choose:' \
  279. 80 40 20 $themelist 2> $data
  280. sel=$?
  281. case $sel in
  282. 1) return;;
  283. 255) return;;
  284. esac
  285. CHOSEN_THEME_INDEX=$(cat $data)
  286. echo "$CHOSEN_THEME_INDEX" > $PELICAN_BLOG_INSTALL_DIR/.blog-theme-index
  287. CHOSEN_THEME_INDEX=$((CHOSEN_THEME_INDEX - 1))
  288. CHOSEN_THEME=${THEMES[$CHOSEN_THEME_INDEX]}
  289. if grep -q "THEME=" $PELICAN_BLOG_INSTALL_DIR/pelicanconf.py; then
  290. sed -i "s|THEME=.*|THEME='themes/${CHOSEN_THEME}'|g" $PELICAN_BLOG_INSTALL_DIR/pelicanconf.py
  291. else
  292. echo "THEME='themes/${CHOSEN_THEME}'" >> $PELICAN_BLOG_INSTALL_DIR/pelicanconf.py
  293. fi
  294. pelican_regenerate_blog
  295. }
  296. function configure_interactive_pelican {
  297. data=$(tempfile 2>/dev/null)
  298. trap "rm -f $data" 0 1 2 5 15
  299. dialog --backtitle $"Freedombone Configuration" \
  300. --title $"Pelican Blogging" \
  301. --radiolist $"Choose an operation:" 18 50 11 \
  302. 1 $"New blog entry" off \
  303. 2 $"Edit the previous blog entry" off \
  304. 3 $"Delete the previous blog entry" off \
  305. 4 $"Change theme" off \
  306. 5 $"Exit" off 2> $data
  307. sel=$?
  308. case $sel in
  309. 1) return;;
  310. 255) return;;
  311. esac
  312. case $(cat $data) in
  313. 1) pelican_new_blog;;
  314. 2) pelican_edit_blog;;
  315. 3) pelican_delete_blog;;
  316. 4) pelican_change_theme;;
  317. 5) break;;
  318. esac
  319. }
  320. function install_interactive_pelican {
  321. if [ ! $ONION_ONLY ]; then
  322. ONION_ONLY='no'
  323. fi
  324. if [[ $ONION_ONLY != "no" ]]; then
  325. PELICAN_DOMAIN_NAME='pelican.local'
  326. else
  327. PELICAN_DETAILS_COMPLETE=
  328. while [ ! $PELICAN_DETAILS_COMPLETE ]
  329. do
  330. data=$(tempfile 2>/dev/null)
  331. trap "rm -f $data" 0 1 2 5 15
  332. if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
  333. dialog --backtitle $"Freedombone Configuration" \
  334. --title $"Pelican Blog Configuration" \
  335. --form $"\nPlease enter your blog details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
  336. $"Domain:" 1 1 "$(grep 'PELICAN_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
  337. $"Code:" 2 1 "$(grep 'PELICAN_BLOG_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 25 33 255 \
  338. 2> $data
  339. else
  340. dialog --backtitle $"Freedombone Configuration" \
  341. --title $"Pelican Blog Configuration" \
  342. --form $"\nPlease enter your GNU Social details. The background image URL can be left blank.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
  343. $"Domain:" 1 1 "$(grep 'PELICAN_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
  344. 2> $data
  345. fi
  346. sel=$?
  347. case $sel in
  348. 1) exit 1;;
  349. 255) exit 1;;
  350. esac
  351. PELICAN_DOMAIN_NAME=$(cat $data | sed -n 1p)
  352. if [ $PELICAN_DOMAIN_NAME ]; then
  353. if [[ $PELICAN_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then
  354. PELICAN_DOMAIN_NAME=""
  355. fi
  356. TEST_DOMAIN_NAME=$PELICAN_DOMAIN_NAME
  357. validate_domain_name
  358. if [[ $TEST_DOMAIN_NAME != $PELICAN_DOMAIN_NAME ]]; then
  359. PELICAN_DOMAIN_NAME=
  360. dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
  361. else
  362. if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
  363. PELICAN_BLOG_CODE=$(cat $data | sed -n 2p)
  364. validate_freedns_code "$PELICAN_BLOG_CODE"
  365. if [ ! $VALID_CODE ]; then
  366. PELICAN_DOMAIN_NAME=
  367. fi
  368. fi
  369. fi
  370. fi
  371. if [ $PELICAN_DOMAIN_NAME ]; then
  372. PELICAN_DETAILS_COMPLETE="yes"
  373. fi
  374. done
  375. # save the results in the config file
  376. write_config_param "PELICAN_BLOG_CODE" "$PELICAN_BLOG_CODE"
  377. fi
  378. write_config_param "PELICAN_DOMAIN_NAME" "$PELICAN_DOMAIN_NAME"
  379. APP_INSTALLED=1
  380. }
  381. function reconfigure_pelican {
  382. echo -n ''
  383. }
  384. function upgrade_pelican {
  385. echo -n ''
  386. }
  387. function backup_local_pelican {
  388. source_directory=/etc/blog
  389. if [ -d $source_directory ]; then
  390. dest_directory=pelican
  391. function_check backup_directory_to_usb
  392. backup_directory_to_usb $source_directory $dest_directory
  393. fi
  394. source_directory=/var/www/$PELICAN_DOMAIN_NAME/htdocs
  395. if [ -d $source_directory ]; then
  396. dest_directory=pelican-site
  397. function_check backup_directory_to_usb
  398. backup_directory_to_usb $source_directory $dest_directory
  399. fi
  400. }
  401. function restore_local_pelican {
  402. if [ -d /etc/blog ]; then
  403. if [ -d $USB_MOUNT_DLNA/backup/pelican ]; then
  404. temp_restore_dir=/root/temppelican
  405. function_check restore_directory_from_usb
  406. restore_directory_from_usb $temp_restore_dir pelican
  407. cp -r $temp_restore_dir/etc/blog/* /etc/blog/
  408. if [ ! "$?" = "0" ]; then
  409. rm -rf $temp_restore_dir
  410. function_check set_user_permissions
  411. set_user_permissions
  412. function_check backup_unmount_drive
  413. backup_unmount_drive
  414. exit 527942
  415. fi
  416. rm -rf $temp_restore_dir
  417. fi
  418. fi
  419. if [ -d /var/www/$PELICAN_DOMAIN_NAME/htdocs ]; then
  420. if [ -d $USB_MOUNT_DLNA/backup/pelican-site ]; then
  421. temp_restore_dir=/root/temppelican-site
  422. function_check restore_directory_from_usb
  423. restore_directory_from_usb $temp_restore_dir pelican-site
  424. cp -r $temp_restore_dir/var/www/$PELICAN_DOMAIN_NAME/htdocs/* /var/www/$PELICAN_DOMAIN_NAME/htdocs/
  425. if [ ! "$?" = "0" ]; then
  426. rm -rf $temp_restore_dir
  427. function_check set_user_permissions
  428. set_user_permissions
  429. function_check backup_unmount_drive
  430. backup_unmount_drive
  431. exit 2946282
  432. fi
  433. rm -rf $temp_restore_dir
  434. fi
  435. fi
  436. }
  437. function backup_remote_pelican {
  438. if [ -d /etc/blog ]; then
  439. backup_directory_to_friend /etc/blog pelican
  440. fi
  441. if [ -d /var/www/$PELICAN_DOMAIN_NAME/htdocs ]; then
  442. backup_directory_to_friend /var/www/$PELICAN_DOMAIN_NAME/htdocs pelican-site
  443. fi
  444. }
  445. function restore_remote_pelican {
  446. if [ -d /etc/blog ]; then
  447. if [ -d $SERVER_DIRECTORY/backup/pelican ]; then
  448. temp_restore_dir=/root/temppelican
  449. function_check restore_directory_from_friend
  450. restore_directory_from_friend $temp_restore_dir pelican
  451. cp -r $temp_restore_dir/etc/blog/* /etc/blog/
  452. if [ ! "$?" = "0" ]; then
  453. exit 782352
  454. fi
  455. rm -rf $temp_restore_dir
  456. fi
  457. fi
  458. if [ -d /var/www/$PELICAN_DOMAIN_NAME/htdocs ]; then
  459. if [ -d $SERVER_DIRECTORY/backup/pelican-site ]; then
  460. temp_restore_dir=/root/temppelican-site
  461. function_check restore_directory_from_friend
  462. restore_directory_from_friend $temp_restore_dir pelican-site
  463. cp -r $temp_restore_dir/var/www/$PELICAN_DOMAIN_NAME/htdocs/* /var/www/$PELICAN_DOMAIN_NAME/htdocs/
  464. if [ ! "$?" = "0" ]; then
  465. exit 76382562
  466. fi
  467. rm -rf $temp_restore_dir
  468. fi
  469. fi
  470. }
  471. function remove_pelican {
  472. if [ -f /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME ]; then
  473. nginx_dissite pelican
  474. rm /etc/nginx/sites-available/$PELICAN_DOMAIN_NAME
  475. if [ -d /var/www/$PELICAN_DOMAIN_NAME ]; then
  476. rm -rf /var/www/$PELICAN_DOMAIN_NAME
  477. fi
  478. systemctl reload nginx
  479. fi
  480. pip uninstall pelican
  481. remove_certs $PELICAN_DOMAIN_NAME
  482. function_check remove_onion_service
  483. remove_onion_service pelican ${PELICAN_ONION_PORT}
  484. remove_app pelican
  485. systemctl restart tor
  486. }
  487. function create_pelican_conf {
  488. STATIC_BLOG_FILE=$1
  489. echo '#!/usr/bin/env python' > $STATIC_BLOG_FILE
  490. echo '# -*- coding: utf-8 -*- #' >> $STATIC_BLOG_FILE
  491. echo 'from __future__ import unicode_literals' >> $STATIC_BLOG_FILE
  492. echo '' >> $STATIC_BLOG_FILE
  493. echo "AUTHOR=u\"$MY_USERNAME\"" >> $STATIC_BLOG_FILE
  494. echo "SITENAME=u'$DEFAULT_BLOG_TITLE'" >> $STATIC_BLOG_FILE
  495. echo "SITEURL=''" >> $STATIC_BLOG_FILE
  496. echo "PATH='content'" >> $STATIC_BLOG_FILE
  497. echo 'TIMEZONE=u"Europe/London"' >> $STATIC_BLOG_FILE
  498. echo "DEFAULT_LANG=u'en'" >> $STATIC_BLOG_FILE
  499. echo '' >> $STATIC_BLOG_FILE
  500. echo 'FEED_ALL_ATOM=None' >> $STATIC_BLOG_FILE
  501. echo 'CATEGORY_FEED_ATOM=None' >> $STATIC_BLOG_FILE
  502. echo 'TRANSLATION_FEED_ATOM=None' >> $STATIC_BLOG_FILE
  503. echo 'AUTHOR_FEED_ATOM=None' >> $STATIC_BLOG_FILE
  504. echo 'AUTHOR_FEED_RSS=None' >> $STATIC_BLOG_FILE
  505. echo '' >> $STATIC_BLOG_FILE
  506. echo 'DEFAULT_PAGINATION=False' >> $STATIC_BLOG_FILE
  507. echo 'RELATIVE_URLS=True' >> $STATIC_BLOG_FILE
  508. echo "THEME='themes/nice-blog'" >> $STATIC_BLOG_FILE
  509. }
  510. function create_pelican_makefile {
  511. STATIC_BLOG_FILE=$1
  512. echo 'PY?=python' > $STATIC_BLOG_FILE
  513. echo 'PELICAN?=pelican' >> $STATIC_BLOG_FILE
  514. echo 'PELICANOPTS=' >> $STATIC_BLOG_FILE
  515. echo '' >> $STATIC_BLOG_FILE
  516. echo 'BASEDIR=$(CURDIR)' >> $STATIC_BLOG_FILE
  517. echo 'INPUTDIR=$(BASEDIR)/content' >> $STATIC_BLOG_FILE
  518. echo "OUTPUTDIR=$PELICAN_BLOG_PATH" >> $STATIC_BLOG_FILE
  519. echo 'CONFFILE=$(BASEDIR)/pelicanconf.py' >> $STATIC_BLOG_FILE
  520. echo 'PUBLISHCONF=$(BASEDIR)/publishconf.py' >> $STATIC_BLOG_FILE
  521. echo '' >> $STATIC_BLOG_FILE
  522. echo 'DEBUG ?= 0' >> $STATIC_BLOG_FILE
  523. echo 'ifeq ($(DEBUG), 1)' >> $STATIC_BLOG_FILE
  524. echo -e '\tPELICANOPTS += -D' >> $STATIC_BLOG_FILE
  525. echo 'endif' >> $STATIC_BLOG_FILE
  526. echo '' >> $STATIC_BLOG_FILE
  527. echo 'RELATIVE ?= 0' >> $STATIC_BLOG_FILE
  528. echo 'ifeq ($(RELATIVE), 1)' >> $STATIC_BLOG_FILE
  529. echo -e '\tPELICANOPTS += --relative-urls' >> $STATIC_BLOG_FILE
  530. echo 'endif' >> $STATIC_BLOG_FILE
  531. echo '' >> $STATIC_BLOG_FILE
  532. echo 'html:' >> $STATIC_BLOG_FILE
  533. echo -e '\t$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)' >> $STATIC_BLOG_FILE
  534. echo '' >> $STATIC_BLOG_FILE
  535. echo 'clean:' >> $STATIC_BLOG_FILE
  536. echo -e '\t[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)' >> $STATIC_BLOG_FILE
  537. echo '' >> $STATIC_BLOG_FILE
  538. echo 'regenerate:' >> $STATIC_BLOG_FILE
  539. echo -e '\t$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)' >> $STATIC_BLOG_FILE
  540. echo '' >> $STATIC_BLOG_FILE
  541. echo 'serve:' >> $STATIC_BLOG_FILE
  542. echo 'ifdef PORT' >> $STATIC_BLOG_FILE
  543. echo -e '\tcd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)' >> $STATIC_BLOG_FILE
  544. echo 'else' >> $STATIC_BLOG_FILE
  545. echo -e '\tcd $(OUTPUTDIR) && $(PY) -m pelican.server' >> $STATIC_BLOG_FILE
  546. echo 'endif' >> $STATIC_BLOG_FILE
  547. echo '' >> $STATIC_BLOG_FILE
  548. echo 'serve-global:' >> $STATIC_BLOG_FILE
  549. echo 'ifdef SERVER' >> $STATIC_BLOG_FILE
  550. echo -e '\tcd $(OUTPUTDIR) && $(PY) -m pelican.server 80 $(SERVER)' >> $STATIC_BLOG_FILE
  551. echo 'else' >> $STATIC_BLOG_FILE
  552. echo -e '\tcd $(OUTPUTDIR) && $(PY) -m pelican.server 80 0.0.0.0' >> $STATIC_BLOG_FILE
  553. echo 'endif' >> $STATIC_BLOG_FILE
  554. echo '' >> $STATIC_BLOG_FILE
  555. echo 'devserver:' >> $STATIC_BLOG_FILE
  556. echo 'ifdef PORT' >> $STATIC_BLOG_FILE
  557. echo -e '\t$(BASEDIR)/develop_server.sh restart $(PORT)' >> $STATIC_BLOG_FILE
  558. echo 'else' >> $STATIC_BLOG_FILE
  559. echo -e '\t$(BASEDIR)/develop_server.sh restart' >> $STATIC_BLOG_FILE
  560. echo 'endif' >> $STATIC_BLOG_FILE
  561. echo '' >> $STATIC_BLOG_FILE
  562. echo 'stopserver:' >> $STATIC_BLOG_FILE
  563. echo -e '\t$(BASEDIR)/develop_server.sh stop' >> $STATIC_BLOG_FILE
  564. echo -e '\t@echo "Stopped Pelican and SimpleHTTPServer processes running in background."' >> $STATIC_BLOG_FILE
  565. echo '' >> $STATIC_BLOG_FILE
  566. echo 'publish:' >> $STATIC_BLOG_FILE
  567. echo -e '\t$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)' >> $STATIC_BLOG_FILE
  568. echo '' >> $STATIC_BLOG_FILE
  569. echo '.PHONY: html clean regenerate serve serve-global devserver publish' >> $STATIC_BLOG_FILE
  570. }
  571. function create_pelican_publish_conf {
  572. STATIC_BLOG_FILE=$1
  573. echo '#!/usr/bin/env python' > $STATIC_BLOG_FILE
  574. echo '# -*- coding: utf-8 -*- #' >> $STATIC_BLOG_FILE
  575. echo 'from __future__ import unicode_literals' >> $STATIC_BLOG_FILE
  576. echo '' >> $STATIC_BLOG_FILE
  577. echo 'import os' >> $STATIC_BLOG_FILE
  578. echo 'import sys' >> $STATIC_BLOG_FILE
  579. echo 'sys.path.append(os.curdir)' >> $STATIC_BLOG_FILE
  580. echo 'from pelicanconf import *' >> $STATIC_BLOG_FILE
  581. echo '' >> $STATIC_BLOG_FILE
  582. echo "SITEURL = ''" >> $STATIC_BLOG_FILE
  583. echo 'RELATIVE_URLS = True' >> $STATIC_BLOG_FILE
  584. echo '' >> $STATIC_BLOG_FILE
  585. echo "FEED_ALL_ATOM = 'feeds/all.atom.xml'" >> $STATIC_BLOG_FILE
  586. echo "CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'" >> $STATIC_BLOG_FILE
  587. echo '' >> $STATIC_BLOG_FILE
  588. echo 'DELETE_OUTPUT_DIRECTORY = True' >> $STATIC_BLOG_FILE
  589. }
  590. function pelican_themes {
  591. # Clone themes separately because the themes repo sometimes has bad refs
  592. git clone https://github.com/KenMercusLai/BT3-Flat
  593. git clone https://github.com/abr4xas/Casper2Pelican
  594. git clone https://github.com/alexandrevicenzi/Flex
  595. git clone https://github.com/allenskd/Nuja
  596. git clone https://github.com/ir193/Responsive-Pelican
  597. git clone https://github.com/nairobilug/pelican-alchemy
  598. git clone https://github.com/livibetter-backup/apricot
  599. git clone https://github.com/jody-frankowski/blue-penguin
  600. git clone https://github.com/gregseth/pelican-bgh
  601. git clone https://github.com/blueicefield/pelican-blueidea
  602. git clone https://github.com/demianbrecht/pelican-bold
  603. git clone https://github.com/fly/burrito
  604. git clone https://github.com/yuex/pelican-iliork
  605. git clone https://github.com/tbunnyman/pelican-chunk
  606. git clone https://github.com/hdra/Pelican-Cid
  607. git clone https://github.com/gilsondev/pelican-clean-blog
  608. git clone https://github.com/porterjamesj/crowsfoot
  609. git clone https://github.com/22decembre/dev-random3.git
  610. git clone https://github.com/kura/eevee
  611. git clone https://github.com/talha131/pelican-elegant.git
  612. git clone https://github.com/callmefish/pelican-free-agent
  613. git clone https://github.com/jsliang/pelican-fresh
  614. git clone https://github.com/vaiski/genus
  615. git clone https://github.com/PierrePaul/html5-dopetrope
  616. git clone https://github.com/jvanz/pelican-hyde
  617. git clone https://github.com/erfaan/pelican-theme-irfan
  618. git clone https://github.com/slok/iris
  619. git clone https://github.com/badele/pelican-theme-jesuislibre
  620. git clone https://github.com/mothsART/pelican-lab
  621. git clone https://github.com/siovene/lannisport
  622. git clone https://github.com/lazycoder-ru/lazystrap
  623. git clone https://github.com/chdoig/pelican-bootstrap3-lovers
  624. git clone https://github.com/kplaube/maggner-pelican
  625. git clone https://github.com/cpaulik/martin-pelican
  626. git clone https://github.com/greizgh/pelican-material
  627. git clone https://github.com/eswarm/materialistic-pelican
  628. git clone https://github.com/cprieto/pelican-mediumfox
  629. git clone https://github.com/onuraslan/medius
  630. git clone https://github.com/lucachr/pelican-mg
  631. git clone https://github.com/BYK/pelican-neat
  632. git clone https://github.com/molivier/nest
  633. git clone https://github.com/guilherme-toti/nice-blog
  634. git clone https://github.com/gunchu/nikhil-theme
  635. git clone https://github.com/wilbur-ma/niu-x2
  636. git clone https://github.com/duilio/pelican-octopress-theme
  637. git clone https://github.com/Parbhat/pelican-blue
  638. git clone https://github.com/hdra/pelican-cait
  639. git clone https://github.com/laughk/pelican-hss
  640. git clone https://github.com/wrl/pelican-mockingbird
  641. git clone https://github.com/fle/pelican-simplegrey
  642. git clone https://github.com/fle/pelican-sober
  643. git clone https://github.com/ingwinlu/pelican-twitchy
  644. git clone https://github.com/badele/pelicanthemes-generator
  645. git clone https://github.com/jjimenezlopez/pelipress
  646. git clone https://github.com/xm3ron/pjport
  647. git clone https://github.com/kdeldycke/plumage
  648. git clone https://github.com/habibillah/pujangga
  649. git clone https://github.com/danclaudiupop/pure
  650. git clone https://github.com/wamonite/relapse
  651. git clone https://github.com/ellisonleao/pelican-semantic-ui
  652. git clone https://github.com/kdheepak89/pelican-smoothie
  653. git clone https://github.com/if1live/pelican-sora
  654. git clone https://github.com/redVi/storm
  655. git clone https://github.com/keningle/pelican-sundown
  656. git clone https://github.com/giulivo/pelican-svbhack
  657. git clone https://github.com/wting/pelican-svbtle
  658. git clone https://github.com/frankV/twenty-pelican-html5up
  659. git clone https://github.com/robulouski/voidy-bootstrap
  660. git clone https://github.com/samael500/w3-personal-blog
  661. git clone https://github.com/jarv/water-iris
  662. git clone https://github.com/kplaube/yapeme
  663. }
  664. function mesh_install_pelican {
  665. if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" && $VARIANT != "usb" ]]; then
  666. return
  667. fi
  668. chroot "$rootdir" apt-get -yq install python-pip
  669. chroot "$rootdir" pip install ipython
  670. chroot "$rootdir" pip install Markdown
  671. chroot "$rootdir" pip install typogrify
  672. chroot "$rootdir" pip install pelican
  673. PELICAN_BLOG_INSTALL_DIR=/home/$MY_USERNAME/CreateBlog
  674. PELICAN_BLOG_PATH=/home/$MY_USERNAME/Public/Blog
  675. if [ ! -d $rootdir$PELICAN_BLOG_INSTALL_DIR ]; then
  676. mkdir -p $rootdir$PELICAN_BLOG_INSTALL_DIR
  677. fi
  678. if [ ! -d $rootdir$PELICAN_BLOG_PATH ]; then
  679. mkdir -p $rootdir$PELICAN_BLOG_PATH
  680. fi
  681. if [ ! -d $rootdir$PELICAN_BLOG_INSTALL_DIR/content/images ]; then
  682. mkdir -p $rootdir$PELICAN_BLOG_INSTALL_DIR/content/images
  683. fi
  684. create_pelican_conf $rootdir$PELICAN_BLOG_INSTALL_DIR/pelicanconf.py
  685. create_pelican_makefile $rootdir$PELICAN_BLOG_INSTALL_DIR/Makefile
  686. create_pelican_publish_conf $rootdir$PELICAN_BLOG_INSTALL_DIR/publishconf.py
  687. mkdir -p $rootdir$PELICAN_BLOG_INSTALL_DIR/themes
  688. cd $rootdir$PELICAN_BLOG_INSTALL_DIR/themes
  689. pelican_themes
  690. #git clone --recursive $PELICAN_PLUGINS_REPO $rootdir$PELICAN_BLOG_INSTALL_DIR/plugins
  691. chroot "$rootdir" chown -R $MY_USERNAME:$MY_USERNAME $PELICAN_BLOG_INSTALL_DIR
  692. chroot "$rootdir" chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Public
  693. }
  694. function install_pelican {
  695. if [ $INSTALLING_MESH ]; then
  696. mesh_install_pelican
  697. return
  698. fi
  699. apt-get -yq install python-pip
  700. pip install ipython
  701. pip install Markdown
  702. pip install typogrify
  703. pip install pelican
  704. PELICAN_BLOG_PATH=/var/www/$PELICAN_DOMAIN_NAME/htdocs
  705. if [ ! -d $PELICAN_BLOG_INSTALL_DIR ]; then
  706. mkdir -p $PELICAN_BLOG_INSTALL_DIR
  707. fi
  708. if [ ! -d $PELICAN_BLOG_PATH ]; then
  709. mkdir -p $PELICAN_BLOG_PATH
  710. fi
  711. if [ ! -d $PELICAN_BLOG_INSTALL_DIR/content ]; then
  712. mkdir -p $PELICAN_BLOG_INSTALL_DIR/content
  713. fi
  714. create_pelican_conf $PELICAN_BLOG_INSTALL_DIR/pelicanconf.py
  715. create_pelican_makefile $PELICAN_BLOG_INSTALL_DIR/Makefile
  716. create_pelican_publish_conf $PELICAN_BLOG_INSTALL_DIR/publishconf.py
  717. mkdir -p $PELICAN_THEMES_REPO $PELICAN_BLOG_INSTALL_DIR/themes
  718. cd $PELICAN_THEMES_REPO $PELICAN_BLOG_INSTALL_DIR/themes
  719. pelican_themes
  720. #git clone --recursive $PELICAN_PLUGINS_REPO $PELICAN_BLOG_INSTALL_DIR/plugins
  721. chown -R $MY_USERNAME:$MY_USERNAME $PELICAN_BLOG_INSTALL_DIR
  722. chown -R www-data:www-data $PELICAN_BLOG_PATH
  723. pelican_editor_config
  724. PELICAN_ONION_HOSTNAME=$(add_onion_service pelican 80 ${PELICAN_ONION_PORT})
  725. set_completion_param "pelican onion domain" "$PELICAN_ONION_HOSTNAME"
  726. install_pelican_website
  727. install_pelican_website_onion
  728. pelican_regenerate_blog
  729. if [ ! -d $PELICAN_BLOG_INSTALL_DIR/output ]; then
  730. echo $'Failed to generate pelican blog'
  731. exit 521892
  732. fi
  733. function_check nginx_ensite
  734. nginx_ensite $PELICAN_DOMAIN_NAME
  735. systemctl restart nginx
  736. APP_INSTALLED=1
  737. }
  738. # NOTE: deliberately no exit 0