Example #1
0
def main():
    if not check_if_root():
        sys.exit("Please run the setup as root!")

    # 1. Copy script to /usr/local/bin
    shutil.copy("earthpornwallpaper.py", PROGRAM_PATH + "earthpornwallpaper")
    os.chmod(PROGRAM_PATH + "earthpornwallpaper", 0o755)
    log("Copied script")

    # 2. Create directories and remove files
    create_directories()
    clean_directories()
    delete_file(DATA_PATH + "wallpaper_template.xml")
    delete_file(DATA_PATH + "wallpaper.xml")
    log("Created directories")

    # 3. Copy template to appropriate folder
    shutil.copy("wallpaper_template.xml", DATA_PATH)
    os.chown(DATA_PATH + "wallpaper_template.xml", getpwnam(os.getlogin()).pw_uid, -1)
    os.chmod(DATA_PATH + "wallpaper_template.xml", 0o444)
    log("Copied template to the right folder")

    # 4. Create cronjob entry
    crontab = open(CRONTAB_FILE, "w")
    crontab.write(CRONTAB_CONTENT)
    crontab.close()
    log("Written cronjob!")
Example #2
0
def main():
    # 2. Create directories and remove files
    create_directories()
    clean_directories()
    delete_file(DATA_PATH + "wallpaper_template.xml")
    delete_file(DATA_PATH + "wallpaper.xml")
    log("Created directories")

    # 3. Copy template to appropriate folder
    shutil.copy("wallpaper_template.xml", DATA_PATH)
    os.chown(DATA_PATH + "wallpaper_template.xml", getpwnam(os.getlogin()).pw_uid, -1)
    os.chmod(DATA_PATH + "wallpaper_template.xml", 0o444)
    log("Copied template to the right folder")
Example #3
0
def main():
    # 2. Create directories and remove files
    create_directories()
    clean_directories()
    delete_file(DATA_PATH + "wallpaper_template.xml")
    delete_file(DATA_PATH + "wallpaper.xml")
    log("Created directories")

    # 3. Copy template to appropriate folder
    shutil.copy("wallpaper_template.xml", DATA_PATH)
    os.chown(DATA_PATH + "wallpaper_template.xml", getpwnam(os.getlogin()).pw_uid, -1)
    os.chmod(DATA_PATH + "wallpaper_template.xml", 0o444)
    log("Copied template to the right folder")