Fix fedwiki
This commit is contained in:
parent
1da89f4273
commit
e789ed5a63
|
@ -55,50 +55,50 @@ fedwiki_variables=(FEDWIKI_DOMAIN_NAME
|
||||||
|
|
||||||
function fedwiki_remove_bad_links {
|
function fedwiki_remove_bad_links {
|
||||||
if [[ $ONION_ONLY == 'no' ]]; then
|
if [[ $ONION_ONLY == 'no' ]]; then
|
||||||
sed -i "s|link[href='https://maxcdn.bootstrapcdn.com.*|link[href='https://${FEDWIKI_DOMAIN_NAME}/fonts-font-awesome/css/font-awesome.min.css']\").length) {|g" /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js
|
sed -i "s|link\\[href='https://maxcdn.bootstrapcdn.com.*|link\\[href='https://${FEDWIKI_DOMAIN_NAME}/fonts-font-awesome/css/font-awesome.min.css']\").length) {|g" /var/lib/wiki/node_modules/wiki-security-friends/client/security.js
|
||||||
|
|
||||||
sed -i "s|\$('<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com.*|\$('<link rel=\"stylesheet\" href=\"https://${FEDWIKI_DOMAIN_NAME}/fonts-font-awesome/css/font-awesome.min.css\">').appendTo(\"head\");|g" /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js
|
sed -i "s|\$('<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com.*|\$('<link rel=\"stylesheet\" href=\"https://${FEDWIKI_DOMAIN_NAME}/fonts-font-awesome/css/font-awesome.min.css\">').appendTo(\"head\");|g" /var/lib/wiki/node_modules/wiki-security-friends/client/security.js
|
||||||
else
|
else
|
||||||
FEDWIKI_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_fedwiki/hostname)
|
FEDWIKI_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_fedwiki/hostname)
|
||||||
sed -i "s|link[href='https://maxcdn.bootstrapcdn.com.*|link[href='http://${FEDWIKI_ONION_HOSTNAME}/fonts-font-awesome/css/font-awesome.min.css']\").length) {|g" /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js
|
sed -i "s|link\\[href='https://maxcdn.bootstrapcdn.com.*|link\\[href='http://${FEDWIKI_ONION_HOSTNAME}/fonts-font-awesome/css/font-awesome.min.css']\").length) {|g" /var/lib/wiki/node_modules/wiki-security-friends/client/security.js
|
||||||
|
|
||||||
sed -i "s|\$('<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com.*|\$('<link rel=\"stylesheet\" href=\"http://${FEDWIKI_ONION_HOSTNAME}/fonts-font-awesome/css/font-awesome.min.css\">').appendTo(\"head\");|g" /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js
|
sed -i "s|\$('<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com.*|\$('<link rel=\"stylesheet\" href=\"http://${FEDWIKI_ONION_HOSTNAME}/fonts-font-awesome/css/font-awesome.min.css\">').appendTo(\"head\");|g" /var/lib/wiki/node_modules/wiki-security-friends/client/security.js
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/localforage/docs/theme/style.css ]; then
|
if [ -f /var/lib/wiki/node_modules/localforage/docs/theme/style.css ]; then
|
||||||
sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/localforage/docs/theme/style.css
|
sed -i '/googleapi/d' /var/lib/wiki/node_modules/localforage/docs/theme/style.css
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/addAlternativeDialog.html ]; then
|
if [ -f /var/lib/wiki/node_modules/wiki-security-passportjs/views/addAlternativeDialog.html ]; then
|
||||||
sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/addAlternativeDialog.html
|
sed -i '/googleapi/d' /var/lib/wiki/node_modules/wiki-security-passportjs/views/addAlternativeDialog.html
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/done.html ]; then
|
if [ -f /var/lib/wiki/node_modules/wiki-security-passportjs/views/done.html ]; then
|
||||||
sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/done.html
|
sed -i '/googleapi/d' /var/lib/wiki/node_modules/wiki-security-passportjs/views/done.html
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/personaDialog.html ]; then
|
if [ -f /var/lib/wiki/node_modules/wiki-security-passportjs/views/personaDialog.html ]; then
|
||||||
sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/personaDialog.html
|
sed -i '/googleapi/d' /var/lib/wiki/node_modules/wiki-security-passportjs/views/personaDialog.html
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/securityDialog.html ]; then
|
if [ -f /var/lib/wiki/node_modules/wiki-security-passportjs/views/securityDialog.html ]; then
|
||||||
sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/securityDialog.html
|
sed -i '/googleapi/d' /var/lib/wiki/node_modules/wiki-security-passportjs/views/securityDialog.html
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-google-oauth20 ]; then
|
if [ -d /var/lib/wiki/node_modules/passport-google-oauth20 ]; then
|
||||||
rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-google-oauth20
|
rm -rf /var/lib/wiki/node_modules/passport-google-oauth20
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2 ]; then
|
if [ -d /var/lib/wiki/node_modules/passport-oauth2 ]; then
|
||||||
rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2
|
rm -rf /var/lib/wiki/node_modules/passport-oauth2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-twitter ]; then
|
if [ -d /var/lib/wiki/node_modules/passport-twitter ]; then
|
||||||
rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-twitter
|
rm -rf /var/lib/wiki/node_modules/passport-twitter
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-github ]; then
|
if [ -d /var/lib/wiki/node_modules/passport-github ]; then
|
||||||
rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-github
|
rm -rf /var/lib/wiki/node_modules/passport-github
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,13 @@ function upgrade_fedwiki {
|
||||||
|
|
||||||
systemctl stop fedwiki
|
systemctl stop fedwiki
|
||||||
npm upgrade -g wiki@$FEDWIKI_VERSION
|
npm upgrade -g wiki@$FEDWIKI_VERSION
|
||||||
|
|
||||||
|
cp -r /root/.npm-global/lib/node_modules/wiki/* /var/lib/wiki/
|
||||||
|
cp /root/.npm-global/bin/wiki /var/lib/wiki/wiki
|
||||||
|
chown -R fedwiki:fedwiki /var/lib/wiki
|
||||||
|
|
||||||
fedwiki_remove_bad_links
|
fedwiki_remove_bad_links
|
||||||
|
|
||||||
chown -R fedwiki:fedwiki $FEDWIKI_DATA
|
chown -R fedwiki:fedwiki $FEDWIKI_DATA
|
||||||
systemctl start fedwiki
|
systemctl start fedwiki
|
||||||
|
|
||||||
|
@ -302,6 +308,9 @@ function remove_fedwiki {
|
||||||
if [ -d "/var/www/$FEDWIKI_DOMAIN_NAME" ]; then
|
if [ -d "/var/www/$FEDWIKI_DOMAIN_NAME" ]; then
|
||||||
rm -rf "/var/www/$FEDWIKI_DOMAIN_NAME"
|
rm -rf "/var/www/$FEDWIKI_DOMAIN_NAME"
|
||||||
fi
|
fi
|
||||||
|
if [ -d /var/lib/wiki ]; then
|
||||||
|
rm -rf /var/lib/wiki
|
||||||
|
fi
|
||||||
remove_config_param FEDWIKI_DOMAIN_NAME
|
remove_config_param FEDWIKI_DOMAIN_NAME
|
||||||
remove_config_param FEDWIKI_CODE
|
remove_config_param FEDWIKI_CODE
|
||||||
function_check remove_onion_service
|
function_check remove_onion_service
|
||||||
|
@ -437,13 +446,13 @@ function install_fedwiki {
|
||||||
exit 783533
|
exit 783533
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f /usr/local/bin/wiki ]; then
|
if [ ! -f /root/.npm-global/bin/wiki ]; then
|
||||||
echo $'wiki was not installed'
|
echo $'wiki was not installed'
|
||||||
exit 5293524
|
exit 5293524
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d /usr/local/lib/node_modules/wiki ]; then
|
if [ ! -d /root/.npm-global/lib/node_modules/wiki ]; then
|
||||||
echo $'wiki directory not found /usr/local/lib/node_modules/wiki'
|
echo $'wiki directory not found /root/.npm-global/lib/node_modules/wiki'
|
||||||
exit 6285324
|
exit 6285324
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -453,6 +462,10 @@ function install_fedwiki {
|
||||||
FEDWIKI_COOKIE="$(create_password 20)"
|
FEDWIKI_COOKIE="$(create_password 20)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cp -r /root/.npm-global/lib/node_modules/wiki /var/lib
|
||||||
|
cp /root/.npm-global/bin/wiki /var/lib/wiki
|
||||||
|
chown -R fedwiki:fedwiki /var/lib/wiki
|
||||||
|
|
||||||
{ echo '[Unit]';
|
{ echo '[Unit]';
|
||||||
echo 'Description=Fedwiki federated wiki';
|
echo 'Description=Fedwiki federated wiki';
|
||||||
echo 'After=syslog.target';
|
echo 'After=syslog.target';
|
||||||
|
@ -461,8 +474,8 @@ function install_fedwiki {
|
||||||
echo '[Service]';
|
echo '[Service]';
|
||||||
echo 'User=fedwiki';
|
echo 'User=fedwiki';
|
||||||
echo 'Group=fedwiki';
|
echo 'Group=fedwiki';
|
||||||
echo "WorkingDirectory=/usr/local/lib/node_modules/wiki";
|
echo "WorkingDirectory=/var/lib/wiki";
|
||||||
echo "ExecStart=/usr/local/bin/wiki --security_type friends --session_duration 7 --data $FEDWIKI_DATA -p $FEDWIKI_PORT --cookieSecret '${FEDWIKI_COOKIE}'";
|
echo "ExecStart=/var/lib/wiki/wiki --security_type friends --session_duration 7 --data $FEDWIKI_DATA -p $FEDWIKI_PORT --cookieSecret '${FEDWIKI_COOKIE}'";
|
||||||
echo 'StandardOutput=syslog';
|
echo 'StandardOutput=syslog';
|
||||||
echo 'StandardError=syslog';
|
echo 'StandardError=syslog';
|
||||||
echo 'SyslogIdentifier=fedwiki';
|
echo 'SyslogIdentifier=fedwiki';
|
||||||
|
|
|
@ -209,14 +209,14 @@ function upgrade_ghost {
|
||||||
cd "/var/www/$GHOST_DOMAIN_NAME/htdocs" || exit 3468463
|
cd "/var/www/$GHOST_DOMAIN_NAME/htdocs" || exit 3468463
|
||||||
|
|
||||||
npm i -g ghost-cli
|
npm i -g ghost-cli
|
||||||
/usr/local/bin/ghost update &
|
/root/.npm-global/bin/ghost update &
|
||||||
sleep 200
|
sleep 200
|
||||||
ghost_bust
|
ghost_bust
|
||||||
|
|
||||||
ghost_replace_services
|
ghost_replace_services
|
||||||
ghost_remove_offsite_links
|
ghost_remove_offsite_links
|
||||||
|
|
||||||
chown root:root /usr/local/bin/ghost
|
chown root:root /root/.npm-global/bin/ghost
|
||||||
chown -R root:root /usr/local/lib
|
chown -R root:root /usr/local/lib
|
||||||
chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
|
chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
|
||||||
systemctl restart ghost
|
systemctl restart ghost
|
||||||
|
@ -429,8 +429,8 @@ function install_ghost {
|
||||||
install_nodejs ghost
|
install_nodejs ghost
|
||||||
|
|
||||||
# now install ghost itself
|
# now install ghost itself
|
||||||
npm install -g ghost-cli@latest
|
npm install -g ghost-cli@1.6.0
|
||||||
if [ ! -f /usr/local/bin/ghost ]; then
|
if [ ! -f /root/.npm-global/bin/ghost ]; then
|
||||||
echo $'ghost was not installed'
|
echo $'ghost was not installed'
|
||||||
exit 738539
|
exit 738539
|
||||||
fi
|
fi
|
||||||
|
@ -438,11 +438,18 @@ function install_ghost {
|
||||||
GHOST_ONION_HOSTNAME=$(add_onion_service ghost 80 ${GHOST_ONION_PORT})
|
GHOST_ONION_HOSTNAME=$(add_onion_service ghost 80 ${GHOST_ONION_PORT})
|
||||||
|
|
||||||
npm install -g yarn
|
npm install -g yarn
|
||||||
|
if [ ! -f /root/.npm-global/bin/yarn ]; then
|
||||||
|
echo $'yarn was not installed'
|
||||||
|
exit 2648246
|
||||||
|
fi
|
||||||
yarn install --no-emoji --no-progress
|
yarn install --no-emoji --no-progress
|
||||||
yarn cache clean
|
yarn cache clean
|
||||||
adduser --system --home="/var/www/${GHOST_DOMAIN_NAME}/htdocs/" --group ghost
|
adduser --system --home="/var/www/${GHOST_DOMAIN_NAME}/htdocs/" --group ghost
|
||||||
rm -rf "/var/www/$GHOST_DOMAIN_NAME/htdocs/"*
|
rm -rf "/var/www/$GHOST_DOMAIN_NAME/htdocs/"*
|
||||||
printf 'y' | ghost install ${GHOST_VERSION} --user ghost --db=sqlite3 --port ${GHOST_PORT} --verbose
|
echo "PATH=$PATH" > setup_ghost
|
||||||
|
echo "ghost install ${GHOST_VERSION} --no-prompt --db=sqlite3 --port ${GHOST_PORT} --verbose" >> setup_ghost
|
||||||
|
chmod +x setup_ghost
|
||||||
|
su -c "setup_ghost" - ghost
|
||||||
|
|
||||||
if [ ! -d "/var/www/$GHOST_DOMAIN_NAME/htdocs/versions" ]; then
|
if [ ! -d "/var/www/$GHOST_DOMAIN_NAME/htdocs/versions" ]; then
|
||||||
echo $'versions directory was not found'
|
echo $'versions directory was not found'
|
||||||
|
@ -487,9 +494,9 @@ function install_ghost {
|
||||||
echo 'User=ghost';
|
echo 'User=ghost';
|
||||||
echo 'Group=ghost';
|
echo 'Group=ghost';
|
||||||
echo "WorkingDirectory=/var/www/${GHOST_DOMAIN_NAME}/htdocs";
|
echo "WorkingDirectory=/var/www/${GHOST_DOMAIN_NAME}/htdocs";
|
||||||
echo "ExecStart=/usr/local/bin/ghost run -D";
|
echo "ExecStart=/root/.npm-global/bin/ghost run -D";
|
||||||
echo "ExecStop=/usr/local/bin/ghost stop";
|
echo "ExecStop=/root/.npm-global/bin/ghost stop";
|
||||||
echo "ExecRestart=/usr/local/bin/ghost restart";
|
echo "ExecRestart=/root/.npm-global/bin/ghost restart";
|
||||||
echo 'Restart=always';
|
echo 'Restart=always';
|
||||||
echo 'RestartSec=60';
|
echo 'RestartSec=60';
|
||||||
echo "Environment=NODE_ENV=development PORT=${GHOST_PORT}";
|
echo "Environment=NODE_ENV=development PORT=${GHOST_PORT}";
|
||||||
|
@ -587,7 +594,7 @@ function install_ghost {
|
||||||
function_check add_ddns_domain
|
function_check add_ddns_domain
|
||||||
add_ddns_domain "$GHOST_DOMAIN_NAME"
|
add_ddns_domain "$GHOST_DOMAIN_NAME"
|
||||||
|
|
||||||
chown root:root /usr/local/bin/ghost
|
chown root:root /root/.npm-global/bin/ghost
|
||||||
chown -R root:root /usr/local/lib
|
chown -R root:root /usr/local/lib
|
||||||
chown -R ghost: "/var/www/${GHOST_DOMAIN_NAME}/htdocs"
|
chown -R ghost: "/var/www/${GHOST_DOMAIN_NAME}/htdocs"
|
||||||
set_completion_param "ghost domain" "$GHOST_DOMAIN_NAME"
|
set_completion_param "ghost domain" "$GHOST_DOMAIN_NAME"
|
||||||
|
|
Loading…
Reference in New Issue