Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # ,___
- # ¡ _` BlackBuntu's Core
- # ª_/() noes1s
- # |\` `, http://pastebin.com/u/noes1s
- # _·' l CC BY-SA 3.0
- #___________________________________________________________________________________________________
- #Folders:
- bbuntu=/usr/share/Bbuntu
- icons=/usr/share/Bbuntu/icons
- logpath=/usr/share/Bbuntu/logs
- binpath=/usr/share/Bbuntu/bin
- folders=("$bbuntu" "$icons" "$logpath" "$binpath")
- #___________________________________________________________________________________________________
- dependencies=(
- aptitude
- unzip
- convert
- )
- remove=(
- openoffice
- )
- repositories=(
- ppa:tualatrix/ppa #ubuntu-tweak
- ppa:libreoffice/ppa
- ppa:tiheum/equinox #faenza-icon-theme
- )
- install=(
- ubuntu-tweak
- libreoffice
- libreoffice-gnome
- faenza-icon-theme
- computertemp
- gimp
- mplayer
- smplayer
- gnome-mplayer
- sun-java6-jre
- sun-java6-plugin
- apache2
- php5
- libapache2-mod-php5
- mysql-server
- php5-mysql
- phpmyadmin
- )
- ffaddons=(
- noscript 722
- foxyproxy 2464
- )
- #___________________________________________________________________________________________________
- log(){ # $1(status) $2(name)
- status=$1
- [[ "$status" = '++' ]]&& status='\e[1;32m++\e[m'
- [[ "$status" = '--' ]]&& status='\e[1;31m--\e[m'
- [[ "$status" = '<<' ]]&& status='\e[1;33m<<\e[m'
- [[ "$status" = '>>' ]]&& status='\e[1;35m>>\e[m'
- [[ "$status" = '<>' ]]&& status='\e[1;37m>>\e[m'
- [[ "$status" = '??' ]]&& status='\e[1;31m>>\e[m'
- [[ "$status" = '**' ]]&& status='\e[1;32m>>\e[m'
- echo -e "[$(date +%R':'%S)] $status $2" >> $logpath/install.log
- echo -e "[$(date +%R':'%S)] $status $2" > /dev/stdout
- }
- addbin(){ # $1(name) $2(command) $3(term/--)
- if [[ ! -e /usr/bin/$1.sh ]]; then
- echo -e "#!/bin/sh\n" > /usr/bin/$1.sh
- if [[ $3 = 'term' ]]; then
- echo "gnome-terminal --title=$1 --working-directory=/tmp --command=$2" >> /usr/bin/$1.sh
- else
- echo "$2" >> /usr/bin/$1.sh
- fi
- chmod +x /usr/bin/$1.sh
- log "+" "$1.sh chmod +x"
- log "+" "$1.sh created in /usr/bin/."
- else
- log "I" "$1 already in /usr/bin. Not added." && return 1
- fi
- }
- adddirectory(){ # $1(name)
- if [[ -e /usr/share/desktop-directories/$1.directory) ]]; then
- echo "[Desktop Entry]
- Name=$1
- Comment=$1 tools
- Icon=/usr/share/Infond/pictures/$1.png
- Type=Directory
- Categories=$1" > /usr/share/desktop-directories/$1.directory
- log "++" "$1.directory written"
- else
- log "<>" "$1.directory already exists. Not updated."
- fi
- }
- addicon(){ # $1(name) $2(link)
- if [[ -e $icons/$1.png ]]; then
- wget $2 -P /tmp
- convert -size 48x48 /tmp/$2 -resize 48x48 -extent 48x48 +profile '*' $icons/$1.png
- rm /tmp/$2
- log "++" "$1 icon downloaded"
- else
- log "<>" "$1 icon already exists. Not downloaded."
- fi
- }
- addcategory(){ # $1(name) $2(categories)
- category=$(grep 'Categories' /usr/share/applications/$1.desktop |sed 's/.*=//')
- if [[ -e /usr/share/applications/$1.desktop ]]; then
- sed -i "s/Categories.*/Categories=$2;/" /usr/share/applications/$1.desktop &&
- log "++" "$1.desktop $category changed to: $2"
- else
- log "??" "$1.desktop file not found"
- fi
- }
- addmenu(){ # $1(name) $2(comment) $3(command) $4(terminal=true/false) $5(category)
- if [ -z "$(ls /usr/share/applications | grep $1.desktop)" ];then
- echo "
- [Desktop Entry]
- Type=Application
- Encoding=UTF-8
- Name=$1
- Comment=$2
- Icon=/usr/share/Infond/pictures/$1.png
- Exec=$3
- Terminal=$4
- Categories=$5
- " > /usr/share/applications/$1.desktop &&
- log "++" "$1.desktop created"
- else
- log "<>" "$1.desktop already exists."
- fi
- }
- #___________________________________________________________________________________________________
- # START
- #___________________________________________________________________________________________________
- #((UID)) && echo -e "\n\e[1;31m"' (!) '"\e[msudo bash $0\n" && exit 1
- ! ping -c2 tiny.cc >/dev/null && echo -e "\n\e[1;31m"' (!) '"\e[mInternet required\n" && exit 1
- # Redirect outputs:
- 1>/dev/null
- 2>/dev/null
- # Create required folders:
- for x in "${folders[@]}"; { [[ ! -e $x ]] && mkdir $x ;}
- # Refresh/add log's date:
- [[ grep "$(date +%D)" $logpath/install.log ]]&& echo -e "\n$(date +%D)\n" >> $logpath/install.log
- # Install required dependencies from "dependencies" list:
- for x in "${dependencies[@]}"; do
- if [[ ! which $x ]]; then
- apt-get install -y $x && log "++" "$x installed" || log "??" "$x installation failed"
- [[ $x = aptitude ]]&& aptitude update
- fi
- done
- # Manual Repositories?
- # Dist-upgrade / Update / Upgrade?
- # Close firefox?
- # Purge applications from "remove" list:
- for x in "${remove[@]}"; do
- state=$(aptitude show $x | awk '/State/{print $2}')
- if [[ $state = installed ]]; then
- apt-get --auto-remove -y --allow-unauthenticated purge $x &&
- log '--' "$x removed and purged"
- elif [[ $state = not ]]; then
- log '<>' "$x not removed, not installed."
- else
- log '??' "$x removing error, not found."
- fi
- done
- # Add all repositories from "repositories" list:
- for x in "${repositories[@]}"; do
- add-apt-repository $x
- log '++' "The repository '$x' has been added."
- done
- # Setup applications from "install" list:
- for x in "${install[@]}"; do
- state=$(aptitude show $x | awk '/State/{print $2}')
- if [[ $state = not ]]; then
- aptitude -y install $x &&
- log '++' "$x has been installed."
- elif [[ $state = installed ]]; then
- aptitude -y install $x &&
- log '<>' "$x using the latest version."
- else
- log '??' "$x installation error, not found."
- fi
- done
- # Change application's category:
- # Install firefox extensions from "ffaddon" list:
- extensionDir="/usr/share/mozilla/extensions/$(ls /usr/share/mozilla/extensions)"
- addlink=https://addons.mozilla.org/en-US/firefox/downloads/latest
- for x in "${ffaddons[@]}"; do
- app=$(echo $x |awk {print $1})
- number=$(echo $x |awk {print $2})
- if [[ -z "$(ls -R $extensionDir | grep $app)" ]]; then
- wget $addlink/$number/addon-$number-latest.xpi -nc -P $extensionDir &&
- log "++" "$app firefox extension installed."
- else
- log "<>" "$app firefox extension already installed. .xpi not downloaded."
- fi
- done
- firefox -silent -offline
- #___________________________________________________________________________________________________
- #
- # Custom installations / configurations
- # _________________________________
- # apache2, php, mysql, phpmyadmin
- log '**' 'Configuring Apache2...'
- # configure for local use only
- echo Listen 127.0.0.1:80 > /etc/apache2/ports.conf
- echo Listen 127.0.0.1:443 >> /etc/apache2/ports.conf
- # ssl
- a2enmod ssl
- make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/ssl/private/localhost.pem
- cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
- sed -i '1,2s/\*:80/*:443/' /etc/apache2/sites-available/ssl
- sed -i "3a\\\tSSLEngine On\n\tSSLCertificateFile /etc/ssl/private/localhost.pem" \
- /etc/apache2/sites-available/ssl
- a2ensite ssl
- # restart apache
- /etc/init.d/apache2 restart
- # chmod every other files
- id=$(ls /home)
- chown $id:$id /usr/share/Bbuntu -R
- chmod -R 744 /usr/share/Bbuntu
- # EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement