Script fixes and add fedora-setup
This commit is contained in:
parent
81790064b4
commit
d73f74c130
|
@ -5,7 +5,7 @@ locations. It's mainly to do a weekly check of all my backup locations and
|
||||||
identify bit rot before it's too late.
|
identify bit rot before it's too late.
|
||||||
|
|
||||||
Install via `crontab -e`:
|
Install via `crontab -e`:
|
||||||
0 2 * * 0 /home/noah/bin/backup-check
|
0 2 * * 0 /home/kirsle/bin/backup-check
|
||||||
|
|
||||||
--Kirsle
|
--Kirsle
|
||||||
http://sh.kirsle.net/
|
http://sh.kirsle.net/
|
||||||
|
@ -18,10 +18,9 @@ import subprocess
|
||||||
# Directories to compare with each other.
|
# Directories to compare with each other.
|
||||||
DIRECTORIES = [
|
DIRECTORIES = [
|
||||||
"/mnt/Midnight/Images/Organized",
|
"/mnt/Midnight/Images/Organized",
|
||||||
"/run/media/noah/Cyro/Pictures/Organized",
|
"/run/media/kirsle/Cyro/Pictures/Organized",
|
||||||
"/run/media/noah/Obelisk/Redundant/Images/Organized",
|
"/run/media/kirsle/Obelisk/Redundant/Images/Organized",
|
||||||
"/home/noah/Dropbox/Photos/Organized",
|
"/home/kirsle/Dropbox/Photos/Organized",
|
||||||
"/home/noah/ownCloud/Photos/Organized",
|
|
||||||
]
|
]
|
||||||
ERROR_OUT = "/home/noah/Desktop/Checksum Error.txt"
|
ERROR_OUT = "/home/noah/Desktop/Checksum Error.txt"
|
||||||
|
|
||||||
|
|
113
home/bin/fedora-setup
Executable file
113
home/bin/fedora-setup
Executable file
|
@ -0,0 +1,113 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
"""
|
||||||
|
Installs my favorite programs on a new Fedora system.
|
||||||
|
|
||||||
|
Fonts:
|
||||||
|
- Microsoft core fonts
|
||||||
|
- Emoji fonts
|
||||||
|
|
||||||
|
Apps:
|
||||||
|
- Firefox, Thunderbird
|
||||||
|
- Eye of Gnome, File Roller, Gedit, GIMP
|
||||||
|
- Banshee
|
||||||
|
|
||||||
|
Dev stuff:
|
||||||
|
- zsh
|
||||||
|
- python-virtualenvwrapper
|
||||||
|
- git
|
||||||
|
|
||||||
|
Filesystems:
|
||||||
|
- fuse-encfs
|
||||||
|
- fuse-exfat
|
||||||
|
- gvfs-mtp
|
||||||
|
|
||||||
|
Misc:
|
||||||
|
- Video codecs
|
||||||
|
- h264 support for Firefox HTML5 videos
|
||||||
|
- VLC Media Player
|
||||||
|
|
||||||
|
Themes:
|
||||||
|
- Bluecurve Cursor Theme
|
||||||
|
- Solar Plymouth Theme
|
||||||
|
|
||||||
|
--Kirsle
|
||||||
|
http://sh.kirsle.net/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
class Application(object):
|
||||||
|
def __init__(self):
|
||||||
|
self.to_install = []
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
"""Main entry point of the app."""
|
||||||
|
|
||||||
|
# Update first.
|
||||||
|
self.shell("sudo dnf -y update")
|
||||||
|
|
||||||
|
# The latest RPM Fusion.
|
||||||
|
if not self.test("rpm -q rpmfusion-free-release"):
|
||||||
|
self.shell("sudo dnf install --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm")
|
||||||
|
|
||||||
|
# Microsoft core fonts and Emoji support.
|
||||||
|
if not self.test("rpm -q msttcore-fonts"):
|
||||||
|
self.shell("sudo dnf install http://rpm.kirsle.net/any/rpm/msttcore-fonts-2.0-3.noarch.rpm")
|
||||||
|
self.install("gdouros-symbola-fonts")
|
||||||
|
|
||||||
|
# Themes
|
||||||
|
self.install("bluecurve-cursor-theme")
|
||||||
|
if not self.test("rpm -q plymouth-theme-solar"):
|
||||||
|
self.install("plymouth-theme-solar")
|
||||||
|
self.commit()
|
||||||
|
self.shell("sudo plymouth-set-default-theme solar && sudo dracut -f")
|
||||||
|
|
||||||
|
# My favorite desktop apps.
|
||||||
|
self.install("firefox", "thunderbird", "eog", "file-roller",
|
||||||
|
"gedit", "gimp", "libreoffice", "banshee")
|
||||||
|
|
||||||
|
# Development stuff.
|
||||||
|
self.install("git", "zsh", "python-virtualenvwrapper")
|
||||||
|
|
||||||
|
# Filesystems
|
||||||
|
self.install("fuse-encfs", "fuse-exfat", "gvfs-mtp")
|
||||||
|
|
||||||
|
# Codecs and plugins and Firefox h264 video support
|
||||||
|
self.install("gstreamer1-libav", "gstreamer1-vaapi",
|
||||||
|
"gstreamer1-plugins-good", "gstreamer1-plugins-ugly",
|
||||||
|
"gstreamer1-plugins-good-extras", "gstreamer1-plugins-bad-free",
|
||||||
|
"gstreamer1-plugins-bad-freeworld", "vlc")
|
||||||
|
|
||||||
|
self.commit()
|
||||||
|
|
||||||
|
def install(self, *rpm):
|
||||||
|
"""Name an rpm I wanna install. Checks if it's already installed first,
|
||||||
|
then adds it to the self.to_install list."""
|
||||||
|
for item in rpm:
|
||||||
|
if not self.test("rpm -q {}".format(item)):
|
||||||
|
print("* To install: {}".format(item))
|
||||||
|
self.to_install.append(item)
|
||||||
|
|
||||||
|
def commit(self):
|
||||||
|
"""Install the pending RPMs."""
|
||||||
|
if len(self.to_install) > 0:
|
||||||
|
print("Installing...")
|
||||||
|
self.shell("sudo dnf -y install {}".format(" ".join(self.to_install)))
|
||||||
|
self.to_install = []
|
||||||
|
|
||||||
|
def shell(self, cmd):
|
||||||
|
print("EXECUTE: {}".format(cmd))
|
||||||
|
subprocess.call(cmd, shell=True)
|
||||||
|
|
||||||
|
def test(self, command):
|
||||||
|
"""Test if a command exits successfully."""
|
||||||
|
try:
|
||||||
|
subprocess.check_call("{} >/dev/null 2>&1".format(command), shell=True)
|
||||||
|
return True
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app = Application()
|
||||||
|
app.main()
|
|
@ -27,29 +27,29 @@ TARGETS = OrderedDict([
|
||||||
path = "/mnt/Midnight/Images/Organized",
|
path = "/mnt/Midnight/Images/Organized",
|
||||||
)),
|
)),
|
||||||
("Cyro", dict(
|
("Cyro", dict(
|
||||||
path = "/run/media/noah/Cyro/Pictures/Organized",
|
path = "/run/media/kirsle/Cyro/Pictures/Organized",
|
||||||
)),
|
)),
|
||||||
("Obelisk", dict(
|
("Obelisk", dict(
|
||||||
path = "/run/media/noah/Obelisk/Redundant/Images/Organized",
|
path = "/run/media/kirsle/Obelisk/Redundant/Images/Organized",
|
||||||
rsync = "rsync -avu --no-p --delete {source}/ \"{destination}/\"",
|
rsync = "rsync -avu --no-p --delete {source}/ \"{destination}/\"",
|
||||||
)),
|
)),
|
||||||
("Rosewill", dict(
|
("Rosewill", dict(
|
||||||
path = "/run/media/noah/Rosewill/Redundant/Images/Organized",
|
path = "/run/media/kirsle/Rosewill/Redundant/Images/Organized",
|
||||||
)),
|
)),
|
||||||
|
|
||||||
# Dropbox volumes.
|
# Dropbox volumes.
|
||||||
("Dropbox", dict(
|
("Dropbox", dict(
|
||||||
path = "/home/noah/Dropbox/Photos/Organized",
|
path = "/home/kirsle/Dropbox/Photos/Organized",
|
||||||
rsync = "rsync -avu --delete --exclude .X {source}/ {destination}/",
|
rsync = "rsync -avu --delete --exclude .X {source}/ {destination}/",
|
||||||
)),
|
)),
|
||||||
("Vault", dict(
|
("Vault", dict(
|
||||||
path = "/home/noah/Dropbox Vault",
|
path = "/home/kirsle/Dropbox Vault",
|
||||||
rsync = "rsync -avu --delete {source}/.X/ \"{destination}/\"",
|
rsync = "rsync -avu --delete {source}/.X/ \"{destination}/\"",
|
||||||
)),
|
)),
|
||||||
|
|
||||||
# Owncloud backup.
|
# Owncloud backup.
|
||||||
("Owncloud", dict(
|
("Owncloud", dict(
|
||||||
path = "/home/noah/ownCloud/Photos/Organized",
|
path = "/home/kirsle/ownCloud/Photos/Organized",
|
||||||
rsync = "rsync -avu --delete --exclude .X {source}/ {destination}/",
|
rsync = "rsync -avu --delete --exclude .X {source}/ {destination}/",
|
||||||
)),
|
)),
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user