Last active
August 25, 2018 17:27
-
-
Save VMuliadi/b0c39629162e4794adc312dbb3c7f871 to your computer and use it in GitHub Desktop.
An automation script that will handle the full package on my laptop. Using Python 2.7 and Web Scraping technique to get the latest version. Make sure you already installed Python 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
os.system('dnf update -y') | |
os.system('dnf install -y pip python2-lxml') | |
os.system('pip install pip --upgrade') | |
os.system('pip install BeautifulSoup4 lxml') | |
import urllib2 | |
import subprocess | |
from bs4 import BeautifulSoup | |
username = raw_input('Your username : ') | |
kernel_release = subprocess.check_output('uname -r', shell=True).split('.') | |
fedora_arch = kernel_release[len(kernel_release)-2] | |
fedora_version = subprocess.check_output('uname -p', shell=True) | |
page = urllib2.urlopen('https://github.com/atom/atom/releases/') | |
bsoup = BeautifulSoup(page, 'lxml') | |
label_search = bsoup.find('div', {'class':'label-latest'}).find('div', {'class':'release-body'}).find('ul', {'class':'release-downloads'}).findAll('li') | |
atom = '' | |
for link in label_search : | |
download_link = link.find('a', {'rel':'nofollow'}).get('href') | |
if 'rpm' in download_link : | |
atom = 'https://github.com/%s' % download_link | |
page = urllib2.urlopen('https://www.sublimetext.com/3') | |
bsoup = BeautifulSoup(page, 'lxml') | |
sublime_text = bsoup.find('li', {'id':'dl_linux_64'}).findAll('a')[-1].get('href') | |
sublime_file = sublime_text.split('/')[len(sublime_text.split('/'))-1] | |
page = urllib2.urlopen('https://www.apachefriends.org/index.html') | |
bsoup = BeautifulSoup(page, 'lxml') | |
xampp_download = bsoup.findAll('a', {'target':'_blank'})[1].get('href') | |
xampp_filename = xampp_download.split('/')[len(xampp_download.split('/'))-1] | |
page = urllib2.urlopen('http://wps-community.org/download.html') | |
bsoup = BeautifulSoup(page, 'lxml') | |
wpsoffice_dl = bsoup.findAll('li', {'class':'list-download'})[2].find('a').get('href') | |
wpsoffice_file = wpsoffice_dl.split('/')[len(wpsoffice_dl.split('/'))-1] | |
print('\n [-] Installing rpmfusion free and rpmfusion nonfree') | |
os.system('dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm') | |
print('\n [-] Installing PCSXR') | |
os.system('cd /home/%s/Downloads' % username) | |
os.system('git clone https://github.com/mirror/pcsxr') | |
os.system('cd pcsxr/') | |
os.system('dnf install -y libtool automake intltool SDL2-devel gtk3-devel libXtst-devel libXv-devel') | |
os.system('sh autogen.sh && ./configure && make && make install') | |
print('\n [-] Installing PCSX2') | |
os.system('cd /home/%s/Downloads' % username) | |
os.system('wget ftp://195.220.108.108/linux/rpmfusion/nonfree/fedora/releases/23/Everything/x86_64/os/Packages/p/pcsx2-1.4-1.fc23.i686.rpm') | |
os.system('dnf install -y pcsx2-1.4-1.fc23.i686.rpm') | |
print('\n [-] Installing VirtualBox') | |
os.system('cd /etc/yum.repos.d/') | |
os.system('wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo') | |
os.system('dnf install -y binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms VirtualBox') | |
os.system('/usr/lib/virtualbox/vboxdrv.sh setup') | |
os.system('usermod -a -G vboxusers %s' % username) | |
print('\n [-] Installing Adobe Reader') | |
os.system('cd /home/%s/Downloads' % username) | |
os.system('wget http://ardownload.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i486linux_enu.rpm') | |
os.system('dnf install -y AdbeRdr9.5.5-1_i486linux_enu.rpm') | |
os.system('cp /opt/Adobe/Reader9/Browser/intellinux/nppdf.so /usr/lib64/mozilla/plugins/') | |
print('\n [-] Installing Fonts and Google Chrome') | |
os.system('cd /home/%s/Downloads' % username) | |
os.system('wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/csa7fff:/adei/openSUSE_12.3/noarch/msttcorefonts-2.0-11.1.noarch.rpm') | |
os.system('wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm') | |
os.system('dnf install -y msttcorefonts-2.0-11.1.noarch.rpm google-chrome-stable_current_x86_64.rpm') | |
print('\n [-] Installing Adobe Flash Player') | |
os.system('cd /home/%s/Downloads' % username) | |
os.system('rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm') | |
os.system('rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux') | |
os.system('dnf install -y flash-plugin alsa-plugins-pulseaudio libcurl') | |
print('\n [-] Installing Atom IDE') | |
os.system('dnf install nodejs npm') | |
os.system('cd /home/%s/Downloads' % username) | |
os.system('wget %s' % atom) | |
os.system('dnf install -y atom.x86_64.rpm') | |
os.system('apm install duotone-dark-syntax duotone-snow duotone-denim-syntax duotone-dusk-syntax duotone-light-syntax duotone-dark-red-syntax duotone-stark-sea-syntax duotone-light-blue-syntax duotone-dark-space-syntax duotone-dark-forest-syntax duotone-dark-earth-syntax duotone-dark-space-muted-syntax duotone-bright-sea-syntax duotone-dark-amethyst-syntax duotone-darksky duotone-blue-dark-syntax duotone-swordart-syntax duotone-carrots-syntax') | |
print('\n [-] Installing WPS Office') | |
os.system('cd /home/%s/Downloads' % username) | |
os.system('wget %s ' % wpsoffice_dl) | |
os.system('dnf install -y %s' % wpsoffice_file) | |
print('\n [-] Installing Sublime Text 3') | |
os.system('cd /opt/') | |
os.system('wget %s' % sublime_text) | |
os.system('wget https://gist.githubusercontent.com/felzan/41371be2c7917d17f26bc9d189accb5c/raw/b95b8dd4b5b1d7ef84f7afeec2f488dd58c7a363/license%2520sublime%2520text --output-document "Sublime Text 3 - License.txt"') | |
os.system('tar -xvf %s' % sublime_file) | |
os.system('mv sublime_text_3 /opt/') | |
print('\n [-] Installing PyCharm Community Edition') | |
os.system('cd /home/%s/Downloads' % username) | |
os.system('dnf copr enable phracek/PyCharm -y ') | |
os.system('dnf install -y pycharm-community-*') | |
print('\n [-] Installing MEGASync and Nautilus Extension') | |
os.system('cd /home/%s/Downloads' % username) | |
os.system('wget https://mega.nz/linux/MEGAsync/Fedora_$(rpm -E %fedora)/x86_64/megasync-Fedora_$(rpm -E %fedora).x86_64.rpm') | |
os.system('wget https://mega.nz/linux/MEGAsync/Fedora_$(rpm -E %fedora)/x86_64/nautilus-megasync-Fedora_$(rpm -E %fedora).x86_64.rpm') | |
os.system('dnf install -y megasync-Fedora_$(rpm -E %fedora).x86_64.rpm nautilus-megasync-Fedora_$(rpm -E %fedora).x86_64.rpm') | |
print('\n [-] Installing XAMPP Package') | |
os.system('cd /home/%s/Downloads' % username) | |
os.system('wget %s' % xampp_download) | |
os.system('chmod u+x %s' % xampp_filename) | |
os.system('./%s' % xampp_filename) | |
print('\n [-] Installing Spotify Client') | |
os.system('dnf config-manager --add-repo=http://negativo17.org/repos/fedora-spotify.repo') | |
os.system('dnf update -y') | |
os.system('dnf install -y spotify-client') | |
print('\n [-] Installing Common Package') | |
os.system('dnf install -y audacious vlc gitg git python-pip python3-pip alacarte uget deluge') | |
os.system('dnf install -y gnome-shell-extension-places-menu guake prozilla pdfmod puddletag wine filezilla') | |
os.system('dnf install -y nano gstreamer1-{fc,libav,plugins-{good,ugly,bad-free}} monodevelop gnome-nettool') | |
os.system('dnf install -y dropbox nautilus-dropbox nautilus-sendto unetbootin qemu wireshark ethtool youtube-dl recordmydesktop') | |
os.system('dnf install -y gimp inkscape openshot gnome-shell-extension-gpaste gnome-shell-extension-alternate-tab gnome-shell-extension-pomodoro') | |
os.system('dnf install -y freetype-freeworld gnome-tweak-tool gnome-shell-extension-background-logo gnome-shell-extension-drive-menu gnome-shell-extension-fedmsg gnome-shell-extension-calc') | |
print ('\n [-] Removing Unneccesarry Package') | |
os.system('dnf remove rhythmbox shotwell totem ImageMagick -y') |
Thank you very much Abdullah Ayub for your correction. I already fix that one.
At this point, I already replace manual download link with latest download link using Web Scraping (using BeautifulSoup)
Some package added :: [New Package] WPS Office, Atom IDE, and Sublime Text IDE
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there! There are a few minor things I have noted in the script. Have a look at them, so people don't get into trouble whilst using the script.
Thank you,
Abdullah