#!/bin/bash # (C) Joshua Ismael Haase Hernández 2010 # This script is free software! You can do what you want with it, as long as you don't convert it into proprietary software # and if you redistribute it either vertabim or modified you must do so under the same licence. tempdir=$(mktemp -d) logdir=$(pwd) logname=$(echo $logdir/arch2parabola$(date +%Y%m%d).log) mirrorfile=$() dependancies=(which date pacman wget seq sed wget test) # "seq" y "test" are in coreutils package # "sudo" might be optdepend or not be # used at all and require to use as root # as I did. # ---------- Function Declarations ---------- # Define the abort procedure. abort () { cat <>$logname <> $logname abort } else { q="" } fi } section=" ---------- Sanity Check ----------" if [ $EUID != 0 ]; then { cat </dev/null 2>/dev/null || { issues="yes" "$x is missing, please install." >> $logname } done # Check if the system is running a custom kernel. pacman -Q kernel26 >/dev/null 2>/dev/null || { issues="yes" cat >>$logname <>$logname 2>> $logname || { echo "Download failed, exiting" >> $logname abort } a=($(cut -d: -f1 blacklist.txt)) echo "Searching for proprietary software on the system." echo "" b[0]="These proprietary software packages have been found on the system:" for i in ${a[@]} ; do pacman -Q $i >/dev/null 2>/dev/null && b[${#b[@]}]=$i done for i in $(seq 0 ${#b[@]}) ; do echo ${b[$i]} echo ${b[$i]} >> $logname done unset b[0] section="---------- Pacman mirrorlist replacement ----------" log_section cat <> $logname <>$logname 2>> $logname || { cat >> $logname <>$logname 2>> $logname || abort pacman -Syy --noconfirm >>$logname 2>> $logname || abort # # Manual way, it should be replaced by a field on blacklist.txt # # Here we declare packages that have a free replacement. # replacements=() # for x in ${replacements[@]}; do # pacman -S --noconfirm $ # done # ----- blacklist.txt way -----. It should be this way, this way # linux-libre, etc, should be updated automaticaly for x in ${b[@]}; do if [$x]; then a=$(grep -e $x[:space:] blacklist.txt | cut -d: f2) if [$a]; then pacman -S --noconfirm $a >>$logname 2>>$logname || abort fi fi done section="---------- Non-free packages removal ----------" log_section cat <>$logname 2>>$logname || abort done rm -rf $tempdir section="---------- You are now on Parabola GNU/Linux ----------" log_section cat <