diff options
author | Leon | 2016-05-08 23:49:50 +0800 |
---|---|---|
committer | Leon | 2016-05-08 23:49:50 +0800 |
commit | 25db395316bd2ea042dee53058bcd42153dc62e8 (patch) | |
tree | 986f903b37d146f4db33e7489f49e8d646749607 /b1freearchiver.install | |
download | aur-25db395316bd2ea042dee53058bcd42153dc62e8.tar.gz |
1.5.86.4849
Diffstat (limited to 'b1freearchiver.install')
-rw-r--r-- | b1freearchiver.install | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/b1freearchiver.install b/b1freearchiver.install new file mode 100644 index 000000000000..0919198a3752 --- /dev/null +++ b/b1freearchiver.install @@ -0,0 +1,70 @@ +update_desktop() { + + xdg-icon-resource forceupdate --theme hicolor &>/dev/null + update-mime-database /usr/share/mime &>/dev/null + update-desktop-database -q + +} + +post_install() { + +update_desktop + +echo "Starting python script for procesing uuid." + +python - <<END + +CONFIG_DIR = '/etc/xdg/b1.org' +CONFIG_INI = '/etc/xdg/b1.org/B1Manager.conf' + +import sys +import os +import uuid +from configparser import RawConfigParser as ConfParser +from configparser import Error + +p = ConfParser() +p.optionxform = str + +try: + results = p.read(CONFIG_INI) +except Error as msg: + if not os.path.exists(CONFIG_DIR): + os.makedirs(CONFIG_DIR) + with open('example.cfg', 'w') as configfile: + configfile.write('[General]\n') + configfile.write('UID = {%s}\n'%str(uuid.uuid1())) + sys.exit(0) +else: + if 'General' in p.sections(): + b1_uuid = p.get('General', 'UID') + else: + b1_uuid = None + + if (b1_uuid is not None) and (len(b1_uuid) > 0): + sys.exit(0) + else: + p.add_section('General') + + p.set('General', 'UID', '{%s}'%str(uuid.uuid1())) + if not os.path.exists(CONFIG_DIR): + os.makedirs(CONFIG_DIR) + with open(CONFIG_INI, 'w') as configfile: + p.write(configfile) + sys.exit(0) + +END + +} + +post_upgrade() { + + update_desktop + +} + +post_remove() { + + update_desktop + +} |