Projects / clone-debian

clone-debian

clone-debian is a Bash shell script to clone the package state of a Debian system. In other words, it replicates the list of currently installed packages from one system to another system. It is fairly simple, but serves it's purpose well.

Licenses

Recent releases

  •  09 Apr 2001 21:55

    Release Notes: This release fixes the error handling problem with dselect and other minor bugs.

    •  08 Apr 2001 07:09

      Release Notes: Improvements to error checking, the ability to disconnect/reconnect any number of times with CTRL-C during the upgrade stage to allow you to find faster servers, exit status errors are now partially automated, and some other minor enhancements.

      •  29 Mar 2001 17:13

        Release Notes: Functionality with the latest debconf on Potato or higher, force options work, catching Ctrl-C, the script cleans itself up, and other minor enhancements and bugfixes.

        •  17 Mar 2001 05:55

          No changes have been submitted for this release.

          Recent comments

          10 Apr 2001 09:43 longshot6

          Re: dpkg --get-selections, dpkg --set-selections

          > dpkg already has similar
          > functionality... Why it is better?


          Hello Balazs,

          To try to answer your question, it isn't intended to be

          better than dpkg --get-selections and dpkg

          --set-selections, it is meant to be an extension of

          those commands. In fact they are pretty much the

          reason for clone-debian's existance, and the utility

          pretty much surrounds their usage. The script doesn't

          do much moe than what could be done by entering

          several commands on each system. But I put quite a bit

          of time figuring out to get it to do what it does

          conviently with a floppy disk. The comment I posted

          above about clone-debian being of some use to single

          computer owners should taken into account.

          Clone-debian is also mostly just an idea I came up

          with to give me some purpose while learning how to do

          bash shell scripting. Since it is my first real bash script I

          was hoping that the idea would be good enough

          something that may be of use somehow to others. It

          may not be much to look at and a little messy since it is

          my first venture into any kind of programming. It's still a

          work in progress though! I have found a couple more

          bugs to fix and have actually gotten a couple of very

          minor feature requests which is probably about all that I

          can handle. But, I thought it may perhaps be useful to

          people that don't have the time to learn or write a bash

          shell script or program of their own, whilst I learn, and

          write it. I also thought there may be many folks out

          there who are new to Debian and/or Linux in general

          that do not know the above mentioned dpkg command

          options and or be dpkg savy, but understand what

          cloning the package state of their Debian system. To

          elaborate, the following is some e-mail that I received

          and then made reply's to....

          Fred Wrote:

          I sent you a message a day or two ago, and here is

          another.

          [oops! please add your email address to *every*

          place you sign

          your name; I cannot find it; and I am very tired; I

          am going to

          look.... but I wish it were easier ... OK, I found your

          email

          address; but in the future, please make it easier ... ]

          Here is a long, complex sources.list file that you might

          adapt for an

          examples directory (no one besides me will want this

          exact file; but

          you can adapt it).

          Hello Bob,

          Thanks for suggestions. I really appreciate your input.

          I'm sorry to say I

          missed your the first e-mail you sent a day or two ago.

          If you still have it

          can you send it again please? I would like to know

          what other idea/suggestion

          it contained.

          I am still learning a lot about Debian/GNU Linux and all

          it's commands, as

          you can probably tell from my script. I will have to learn

          some more advanced

          sytax options of grep and other commands. The

          sample sources.list you gave

          does look pretty complex too! At first glance I would

          need to fill in the

          blanks from your templete I take it? I'm not even sure

          what the egrep command

          given below does exactly, although I know what a

          couple of the options are

          for. This is why I started clone-debian though, to give

          me a purpose in

          learning some of this more in depth.

          By the way, version 0.3 was terrible in the way I was

          trying to have it parse

          the output of dselect/dpkg errors. Get 0.4! I hope it

          fixes the problem. You

          probably already knew how to accompish what my

          script does yourself manually.

          I just wanted to say that I was trying to make my tiny

          little script do it

          for people not familiar with the commands, and maybe

          make the process a

          little easier for people that do know the commands but

          don't have the time

          to take to write their own. I do only have so much time

          to work on it myself,

          it's a spare time project. Would you happen to know

          how I could go about

          making it into a .deb package using the dpkg-deb

          command? I'm trying to learn

          what I need to do to make the debian/rules control file.

          I want to thank you very much for e-mailing me with

          you input. I'm hoping you

          can e-mail me your original a second time. The

          sample sources.list you sent

          looks like it might be a bit of work in itself. I will have a

          look at it.

          Hope to hear from you again.

          Thanks,

          Jimmy Richards

          Thanks for suggestions. I really appreciate your

          input. I'm sorry

          to say I missed your the first e-mail you sent a day

          or two ago. If

          you still have it can you send it again please?

          No problem; I've appended it.

          ... The sample sources.list you gave does look pretty

          complex too!

          At first glance I would need to fill in the blanks from

          your

          templete I take it?

          Actually, you could probably use it more or less as is. It

          is just a

          list of fairly well known apt sites.

          I'm not even sure what the egrep command given

          below does exactly,

          > # Use the command egrep -v '#|^ *$'

          /etc/apt/sources.list

          > # to see what options are active in this file.

          The `-v' option selects lines that do not match the

          regular

          expression. So the command lists all lines that do

          *not* either have

          a sharp sign as their first character or are blank lines

          (i.e.,

          contain zero spaces followed by an end of line or start

          with one or

          more spaces followed by an end of line).

          ...Would you happen to know how I could go about

          making it into a

          .deb package using the dpkg-deb command?

          No, I don't. I have never had time to do anything like

          that.

          Also, I just discovered another program to install

          Debian on multiple

          machines. I don't know anything about it, merely that it

          exists:

          `Replicator': install Debian on multiple machines

          http://replicator.sourceforge.net/

          http://prdownloads.sourceforge.net/replicator/replicator-2.0.tgz

          75755 kb

          http://prdownloads.sourceforge.net/replicator/replicator_2.0.deb

          130,706 kb

          I have no idea how Replicator works, or if it is any

          good. You might

          be able to adapt some ideas from it.

          Here is a copy of the message I sent you earlier:

          Date: Sun, 8 Apr 2001 13:13:35 -0400

          Fred Wrote:

          Subject: clone-debian 0.3

          I am reading the script for clone-debian 0.3.

          It looks like a very useful application. Recently I met a

          fellow who

          is going to teach people at the local Goodwill to

          refurbish old

          computers and hope to persuade him to install Debian

          on them.

          clone-debian will be the tool.

          Here are several comments on the shell script:

          * The script asks:

          echo "Is this system currently a potato system?"

          I myself am running a potato system upgraded to

          testing. Does

          this count as a potato system or not? Please be

          more clear.

          Why do you ask this question? Please tell the user

          right away.

          That way, I will be less confused.

          Please specify the distribution number as well as the

          code name.

          Some people know distributions by their code name;

          others by

          number. You need to cater to both.

          2.0 is hamm

          2.1 is slink

          2.2 is potato (This also includes the potato

          security releases.)

          2.3 is woody

          2.4 is cid

          Also, some people think in terms of `stable', `testing',

          and

          `unstable'. You might mention those, but for a

          *specified* date:

          Is this system currently a Debian 2.2, potato

          system (i.e.,

          the stable distribution as of 2001 Apr 8), and not

          either a

          Debian 2.1, slink system or a Debian 2.3, woody

          system (i.e.,

          the testing distribution as of 2001 Apr 8).

          * When you ask

          echo "Are you upgrading to a newer distribution of

          debian?"

          what do you mean? Every morning I run

          apt-get update

          apt-get dist-upgrade

          Each morning, therefore, my distribution becomes a

          bit newer -- if

          only because of security updates in stable (but also

          because

          testing carries newer versions, too.)

          Please explain why you are asking this question and

          what the

          implications are.

          For example, are you going to tell me that I can

          snapshot my

          current working system (today's testing) and then

          upgrade to

          unstable; and then, if I find that unstable breaks

          everything (as

          it has done several times in the past), I can

          downgrade to my

          snapshot; and do this easily?

          Or are you saying that I can use this in place of

          `apt-get

          dist-upgrade' to go from Debian 2.1 to Debian 2.2.

          If so, why

          should I? `apt-get dist-upgrade' has worked great

          for me.

          * Please shorten your lines, where feasible, to 70

          characters. This

          makes them *much* easier to read. For example,

          you could shorten

          this line in your excellent # --- User input variables

          --- section

          from

          # distro = is this a potato system? the

          'apt.conf' file is in a different location and has a

          different name on potato, on woody or newer it's called

          '70debconf'

          to

          # distro = Is this a Debian 2.2 potato

          system?

          # (Note that the configuration file is

          in

          # /etc/apt/apt.conf in a Debian 2.2

          # potato, but is in

          # /etc/apt/apt.conf.d/70debconf on a

          # Debian 2.3 woody, or newer

          system.)

          By the way, my rewording of your comment is how I

          interpreted what

          you read, after reading the shell script code. When I

          first read

          the wording in the comment, I thought you meant

          that all

          distributions each had a different location. I hope I

          got it right!

          * The script makes a backup of /etc/apt/sources.list

          with this

          command.

          cp -f /etc/apt/sources.list

          /etc/apt/sources.list.clone-debian

          This is fine as it goes, but you will produce an even

          safer back

          up if you also use the -b option, to back up the

          backup.

          * The script asks:

          echo "Do you want to use a modified 'install' file

          that makes dpkg"

          echo "do --force-overwrite, --force-conflicts

          and"

          echo "--force-depends? The original will be

          returned"

          echo "if you press CTRL-C or let the script

          complete."

          echo "[Recommended for upgrading purposes

          only]"

          Please explain the dangers of doing this. Would I

          want to do this

          for a (most likely temporary) upgrade to unstable?

          Would I want to do this if I am currently running

          testing and am

          merely upgrading to whatever is new this morning?

          Would I want to do this if I am currently running the

          stable

          potato and am upgrading my security using the

          Debian 2.2r2 potato

          As is, the question is very confusing and makes me

          worry.

          * The script says:

          echo "#2"

          echo "When 'dselect install' has an error and

          ask's you to Hit Enter to"

          echo "continue, make sure to hit enter twice, not

          just once. Again,"

          echo "if necessary."

          This is confusing. Do I press enter four times if

          hitting twice

          does not do the job, or do I press enter a third time

          if hitting

          twice fails? Does it matter if I press enter more than

          3 or 4

          times? Is the only requirement that I press enter *at

          least*

          twice?

          Also, please note that `hit' is a fine word for young,

          male geeks,

          but you are being unfriendly towards those who

          associate hitting

          with what they have to prevent their young children

          from doing or

          with what happened to them when the police beat

          them up. Please

          be friendly to a wider audience.

          * The script says:

          echo "Do you want to run the 'dselsect install'

          again? [Default = y]"

          Please explain more: tell people whether running

          'dselsect

          install' again is *dangerious* and might screw

          everything up, or

          whether it is safe to do so. (Remember, you have

          told people in

          your warning that this script may well cause them to

          lose

          *everything*. Is this one of those dangerous

          actions? Or can

          they run 'dselsect install' any number of times, with

          no more

          danger running it twice or three times as once? Is it

          more likely

          that if they run 'dselsect install' twice or three times

          that the

          new system will be properly installed?

          * You included an image of yourself in the distribution,

          JIMMY.jpg

          81,599 bytes. I enjoyed looking at it, but the action

          is mean to

          people who pay for their download time by the

          minute.

          Many people overseas pay by the minute, as do

          some people in the

          United States. A good friend of mine, for example,

          has

          residential local telephone service. In many parts of

          the US, the

          telephone company charges a monthly fixed fee for

          unlimited use.

          Not where she lives. She has no choice. She has

          to pay by the

          byte for any download. You are imposing a cost on

          her.

          You are imposing a bigger cost on someone in, say,

          Cameroon, in

          Africa. (I pick Cameroon because I know a fellow

          there who favors

          software freedom.)

          It would be good to see more people in Africa using

          Debian rather

          than Microsoft Windows 98. (Some can get hold of

          tossed out

          machines from companies in the US and Europe.)

          As a practical matter, Microsoft Windows 98 costs

          the same for

          them as a Debian distribution, since they never pay

          license fees.

          Morover the w98 distribution offers partial benefits:

          they can run

          a computer. Of course, the w98 distribution also

          offers crashes

          and takes away users' freedom to study source

          code, modify it, and

          redistribute it. Your imposition of an unnecessary

          cost makes it

          harder to encourage freedom.

          All, in all, this looks like a useful script. I hope you

          develop it

          more. If all goes well, I am hope to teach a fellow to

          use it to

          install Debian on hundreds of refurbished computers

          rather than the

          proprietory system for which he has got an OEM

          license.

          (Incidentally, this fellow, or rather the organizations he

          sets up,

          buys used computers by the ton -- I have never

          thought of purchasing

          computers like that.)

          On Tuesday 10 April 2001 04:51, Betsy wrote:

          I've made a mistake and upgraded a potato box to

          unstable.

          > What I wanted was to upgrade to woody and now I

          realize that woody ==

          > testing.

          >

          > Is it possible to do a dist-upgrade from unstable to

          testing.

          > Can expect to not reload all packages (is there a lot

          of common packages

          > between testing and unstable?)?

          >

          > Thanks,

          > Betsy

          Those e-mails give me some things to consider.

          Now, how does clone-debian extend the dpkg

          commands? It does so by just trying to make them a

          little easier to use in my opinion. For instance, say on a

          source system, it automatically detects whether or not

          you already have a floppy disk mounted upon running

          it. If you do not wish to use the currently mounted

          floppy, it umounts it and then one can be mounted on

          the default mount point by simply pressing Enter. The

          sources.list file copied over to the floppy if you want by

          simply pressing Enter. Of course the packages file is

          put on the floppy upon creation. On the target system,

          same deal with floppy detection. The sources.list file is

          automatically detected and if it exists, you are promted

          whether or not you want it copied over, which is done

          just by pressing enter. If 'upgrading to a newer

          distribution' of Debian, it first gets and installs(with

          apt-get) several newer packages that "I" deemed

          necessary(for lack of a better word at the moment) to

          be installed before continuing(and there may be a

          couple more that should be added). I found they help

          dpkg from having quite so many errors during the

          installation of the remaining hundreds and hundreds of

          packages that I have it install. Also, many people I

          have come across have wondered how you can get

          apt-get to use --force options that dpkg uses. Those

          options can be used by apt-get by placing a perl code

          entry into the proper config file if you have debconf

          installed, /etc/apt/apt.conf for potato and,

          /etc/apt/apt.conf.d/70debconf for woody and sid. My

          utilty makes use of the --force options by

          automatically dectecting which config file you have,

          then inserting the perl code into it. This is what I would

          consider most of the major features of clone-debian,

          but here are a few others. It took me quite a bit of time

          to figure this all out and make it work properly. And

          there still are a few bugs to work out. Like I found out

          there is a problem when you enter a mount point

          manually(rather by using the default by pressing enter)

          and it contains a forward slash on the trailing end.

          Debugging, I guess that's part of the joy of bash shell

          scripting, or whatever kind of programmming.

          Well, I hope this helps anyone who was kind of

          wondering what clone-debian is all about. I feel the

          question has been asked and answered, at any rate.

          Sincerely,

          Jimmy Richards

          10 Apr 2001 06:42 dlux

          dpkg --get-selections, dpkg --set-selections
          dpkg already has similar functionality... Why it is better?

          30 Mar 2001 21:18 longshot6

          Single Computer Owners
          Hello,

          I just wanted to included that clone-debian can be useful for users of only a single computer. It saves you're current package state on a floppy disk, then if you should need to re-install from scratch you can easily get back to having the same packages that you had installed. That is as long as they can be retrieved from a sources.list file.

          Enjoy,

          Jimmy Richards

          Screenshot

          Project Spotlight

          OpenStack4j

          A Fluent OpenStack client API for Java.

          Screenshot

          Project Spotlight

          TurnKey TWiki Appliance

          A TWiki appliance that is easy to use and lightweight.