Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just copied a repository of the previous Ubuntu version (13, saucy). It contains both i386 and amd64 versions of the packages. I want to use this repository on a 64 bit PC. Is there a terminal command I can use to remove all of the i386 versions?

Edit: I am assuming that all packages have a amd64 version. Otherwise, if a package only has an i386 version, I want to retain it.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

A two-stage method would be to create a script which, given a path to a package, checks for the existence of an amd64 version and if it finds such a version, deletes the i386 package.

Something like:

#! /bin/bash

for i
do
    PKG=${i/i386/amd64}
    if [[ -f $PKG ]]
    then
        rm $1
    fi
done

saved as script.sh, for example. And then:

find ${REPOSITORY_ROOT} -iname '*i386.deb' -exec ./script.sh {} +

The whole thing can perhaps be done using a single find command, but this should be enough.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.