diff options
author | 2020-03-03 02:05:54 +0100 | |
---|---|---|
committer | 2020-03-03 02:05:54 +0100 | |
commit | 78259d45d52b1ef8d9a634d86aed11743ea4d39c (patch) | |
tree | cfbaa69a939e929175f0b2013cfde7f963a9e243 /scripts | |
parent | Remove Sven Wegener (diff) | |
download | planet-78259d45d52b1ef8d9a634d86aed11743ea4d39c.tar.gz planet-78259d45d52b1ef8d9a634d86aed11743ea4d39c.tar.bz2 planet-78259d45d52b1ef8d9a634d86aed11743ea4d39c.zip |
Initial version of the pluto based planetv2.0.0
Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/adduser.py | 83 | ||||
-rwxr-xr-x | scripts/error-report | 9 | ||||
-rw-r--r-- | scripts/gravatar.py | 8 | ||||
-rwxr-xr-x | scripts/update-venus | 59 |
4 files changed, 0 insertions, 159 deletions
diff --git a/scripts/adduser.py b/scripts/adduser.py deleted file mode 100644 index 06d4c65..0000000 --- a/scripts/adduser.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python - -# A simple help script to create a new planet/universe config for a new user -# Run it inside the planet-gentoo/ topdir -# WARNING: Always check the changes that are made by this script before commiting -# Many thanks to Arfrever Frehtes Taifersar Arahesis (arfrever@gentoo.org) for his suggestions - -# Author: Theo Chatzimichos <tampakrap@gentoo.org> -# Feel free to contact me via IRC or email - -import sys -import hashlib - -GENERIC_DOMAINS = "aero", "asia", "biz", "cat", "com", "coop", \ - "edu", "gov", "info", "int", "jobs", "mil", "mobi", "museum", \ - "name", "net", "org", "pro", "tel", "travel" - -# the following makes it python3 compatible -if sys.version_info[0] == 2: - input = raw_input - -def check_mail(email, domains = GENERIC_DOMAINS): - # http://commandline.org.uk/python/email-syntax-check/ - - # Checks for a syntactically invalid email address. - # Email address must be 7 characters in total. - if len(email) < 7: - return False # Address too short - - # Split up email address into parts. - try: - localpart, domainname = email.rsplit('@', 1) - host, toplevel = domainname.rsplit('.', 1) - except ValueError: - return False # Address does not have enough parts - - # Check for Country code or Generic Domain. - if len(toplevel) != 2 and toplevel not in domains: - return False # Not a domain name. - - for i in '-_.%+.': - localpart = localpart.replace(i, "") - for i in '-_.': - host = host.replace(i, "") - - if localpart.isalnum() and host.isalnum(): - return True # Email address is fine. - else: - return False # Email has funny characters - -def create_gravatar(email): - h = hashlib.md5() - h.update(email) - return h.hexdigest() - -def create_config(feed,path,nickname,realname,gravatar): - if feed: - f = open('configs/%s/%s' % (path,nickname), 'w') - f.write('[%s]\nusername = %s\nname = %s\ngravatar = %s\n' % (feed,nickname,realname,gravatar)) - f.close() - print('%s config created successfully' % path) - else: - print('No %s config will be created' % path) - -def main(): - realname = input('Real Name: ') - nickname = input('Nickname: ') - email = input('Email (Default: %s@gentoo.org): ' % nickname) - if email == '': - email = nickname + '@gentoo.org' - if check_mail(email): - gravatar = create_gravatar(email) - print('Gravatar hash: %s' % gravatar) - else: - print('Not a valid email address\n') - sys.exit(0) - planet = input('Planet Feed: ') - create_config(planet,'planet',nickname,realname,gravatar) - universe = input('Universe Feed: ') - create_config(universe,'universe',nickname,realname,gravatar) - -if __name__ == '__main__': - main() diff --git a/scripts/error-report b/scripts/error-report deleted file mode 100755 index 9a28f37..0000000 --- a/scripts/error-report +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# At the end of the day, scan the logs of planet/universe, -# grep for errors, sort them, count the duplicate URLs -# and email the planet admins with the result - -for instance in planet universe; do - echo "ERRORS in ${instance}" - find /var/log/planet.gentoo.org/${instance} -type f -atime -7 -exec grep "ERROR" {} \; | grep -v "Errno" | sort | uniq -c -done diff --git a/scripts/gravatar.py b/scripts/gravatar.py deleted file mode 100644 index 940be1f..0000000 --- a/scripts/gravatar.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - -import hashlib -import sys - -h = hashlib.md5() -h.update(sys.argv[1]) -print h.hexdigest() diff --git a/scripts/update-venus b/scripts/update-venus deleted file mode 100755 index 15350e1..0000000 --- a/scripts/update-venus +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -DATE=$(date +%F) -LOG_DATE=$(date +%F-%R) -BASE_DIR="/var/www/planet.gentoo.org" # created by cfengine -REPO="${BASE_DIR}/planet-gentoo" -VENUS_DIR="/usr/lib64/python2.7/site-packages/venus" -[[ -d "${VENUS_DIR}" ]] || VENUS_DIR="/usr/lib/python2.7/site-packages/venus" -LOG_DIR="/var/log/planet.gentoo.org" -BANNED_USERS=( -) - -# Create folders and symlinks (for initial setup) -[[ -d ${BASE_DIR}/htdocs ]] || mkdir ${BASE_DIR}/htdocs -[[ -d ${BASE_DIR}/generated_configs ]] || mkdir ${BASE_DIR}/generated_configs -[[ -L ${BASE_DIR}/htdocs/images ]] || ln -s ${BASE_DIR}/planet-gentoo/media/* ${BASE_DIR}/htdocs -[[ -d ${BASE_DIR}/htdocs/archives ]] || mkdir ${BASE_DIR}/htdocs/archives -[[ -d ${BASE_DIR}/themes_common ]] || mkdir ${BASE_DIR}/themes_common; \ - cp -r /usr/share/webapps/venus/$(ls /usr/share/webapps/venus/ | grep "^20" | sort -r | head -n 1)/themes/common/* ${BASE_DIR}/themes_common/ -[[ -d ${BASE_DIR}/htdocs/universe/archives ]] || mkdir -p ${BASE_DIR}/htdocs/universe/archives -[[ -L ${BASE_DIR}/htdocs/archives/index.php ]] || \ - ln -s ${BASE_DIR}/planet-gentoo/archives/planet/index.php ${BASE_DIR}/htdocs/archives/index.php -[[ -L ${BASE_DIR}/htdocs/universe/archives/index.php ]] || \ - ln -s ${BASE_DIR}/planet-gentoo/archives/universe/index.php ${BASE_DIR}/htdocs/universe/archives/index.php -[[ -L ${BASE_DIR}/htdocs/planet-tyrian.css ]] || \ - ln -s ${BASE_DIR}/planet-gentoo/media/planet-tyrian.css ${BASE_DIR}/htdocs - -# Get latest Git changes -cd ${BASE_DIR}/planet-gentoo -git reset --hard origin/master > /dev/null 2>&1 -git pull --force >/dev/null 2>&1 - -for instance in planet universe; do - # Remove configs of banned users - for banned_user in ${BANNED_USERS[@]}; do - rm -f ${REPO}/configs/${instance}/${banned_user} - done - # Generate the combined ini file from the split config files - cat ${REPO}/configs/base/venus.${instance} ${REPO}/configs/${instance}/* > ${BASE_DIR}/generated_configs/venus.${instance}.ini - # Run venus - python2 ${VENUS_DIR}/planet.py -v ${BASE_DIR}/generated_configs/venus.${instance}.ini > ${LOG_DIR}/${instance}/${LOG_DATE}.log 2>&1 -done - -# Delete old logs -find ${LOG_DIR} -type f -mtime +30 -delete - -# Check for year directory, if not there create both needed -[[ -d ${BASE_DIR}/htdocs/archives/$(date +%G) ]] || \ - mkdir ${BASE_DIR}/htdocs/{,universe/}archives/$(date +%G) -# Archive posts, use -a to retain readable permissions -cp -a ${BASE_DIR}/htdocs/index.html \ - ${BASE_DIR}/htdocs/archives/$(date +%G)/${DATE}.html -cp -a ${BASE_DIR}/htdocs/universe/index.html \ - ${BASE_DIR}/htdocs/universe/archives/$(date +%G)/${DATE}.html -cd ${BASE_DIR}/htdocs/archives -php -d date.timezone=UTC index.php > index.html.gen -[[ $? == 0 ]] && mv index.html.gen index.html -cd ${BASE_DIR}/htdocs/universe/archives -php -d date.timezone=UTC index.php > index.html.gen -[[ $? == 0 ]] && mv index.html.gen index.html |