You are not logged in.

#1 2010-01-29 03:17:03

mdcollins05
Member
Registered: 2010-01-29
Posts: 9

etc-update - For Arch linux

As a long time Gentoo user, I was used to etc-update. After changing to Arch, I tried getting used to the tools available, both in the forums and in the repository. I couldn't do it. So I decided it was better to clone etc-update for Arch linux usage, than to go without updating the config files. So I present to you:

etc-update - For Arch linux

#!/bin/bash

diffcomm="/usr/bin/colordiff"
idiffcomm="/usr/bin/sdiff"
mvcmd="mv -i"
rmcmd="rm -i"

if [ $(whoami) != "root" ]; then
    echo "You need to run this as root."
    exit 1
fi

function diffprompt()
{
  $diffcomm ${config%\.*} ${config%\.*}.pacnew | /bin/less
  echo "${config%\.*} and ${config%\.*}.pacnew"
  echo " R : Replace original with .pacnew file"
  echo " D : Delete .pacnew file"
  echo " I : Interactively merge"
  echo " S : Skip"
  echo " Q : Quit"
  read -p "Enter selection:" action
  action=$(echo $action | tr '[:lower:]' '[:upper:]')
  case "$action" in
    "R" )
    $mvcmd ${config%\.*}.pacnew  ${config%\.*}
    ;;    
    "D" )
    $rmcmd ${config%\.*}.pacnew
    ;;
    "I" )
    $idiffcomm -o ${config%\.*}.tmp ${config%\.*} ${config%\.*}.pacnew
    $mvcmd ${config%\.*}.tmp ${config%\.*}
    $rmcmd ${config%\.*}.pacnew
    ;;
    "S" )
    echo "Skipped"
    ;;
    "Q" )
    exit 1
    ;;
  esac
}

echo "Searching.."
pacnew=$(find / -type f -name "*.pacnew")

for config in $pacnew; do
  diffprompt  
done

By default it uses colordiff, from the colordiff package and sdiff from the distutils package. Also, by default, it'll confirm before deleting or overwriting files.

I actually use it as part of my .bashrc file as an alias.. Like so:

alias sysupdate='pacman -Su; /path/to/etc-update'

Hope someone can get some use out of this!

Edit: Forgot to add: I hope this hasn't been already done, I tried searching, but didn't find anything similar.

Last edited by mdcollins05 (2010-01-29 03:19:12)

Offline

#2 2010-01-29 15:04:01

raymboard
Member
Registered: 2010-01-22
Posts: 61

Re: etc-update - For Arch linux

OK, so what exactly does it do because I don't know what gentoo etc-update is.


Linux is not an operating system it's a kernel. You're using GNU/Linux. http://www.gnu.org/gnu/linux-and-gnu.html

Offline

#3 2010-01-29 15:21:18

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: etc-update - For Arch linux

mdcollins05 wrote:

Edit: Forgot to add: I hope this hasn't been already done, I tried searching, but didn't find anything similar.

Have you seen pacdiff in pacman-contrib?

I too don't know what etc-update does, but it seems to me you are doing what pacdiff does.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#4 2010-01-29 16:28:16

mordoror
Member
Registered: 2010-01-25
Posts: 4

Re: etc-update - For Arch linux

I too was searching for a tool similar to etc-update and I found this wiki article which list a few tools:
http://wiki.archlinux.org/index.php/Pac … save_Files

Offline

#5 2010-01-29 18:07:29

mdcollins05
Member
Registered: 2010-01-29
Posts: 9

Re: etc-update - For Arch linux

Sorry, an explination might help. It searches for .pacnew files, displays the differences between the original and .pacnew and helps to manage them by allowing you to:
Replace the original file with the .pacnew file
Delete the .pacnew file
Interactively merge the original and .pacnew
Skip it for later

Essentially the same functionality as the other tools, just a more familiar way for gentoo's etc-update users.

Offline

Board footer

Powered by FluxBB