Script to setup any fedora install with all my programs

so I want to create a script that can turn any vanelia fedora into what I am using now. so basically there 3 parts to this

  1. backup of my user folder

this is achieved with this rdiff-backup · GitHub
basically I have a script that runs

sudo rdiff-backup --verbosity 5 --print-statistics --include-special-files --include-globbing-filelist /home/zany130/Documents/include-list.txt /home/zany130/ /home/zany130/Rdiff

with the include list looking something like this

- /home/zany130/.cache/
- /home/zany130/.config/Mailspring/
- /home/zany130/.dropbox/
- /home/zany130/.dropbox-dist/
- /home/zany130/.esmtp_queue/
- /home/zany130/.gnupg/
- /home/zany130/.itch/
- /home/zany130/.googleearth/
- /home/zany130/.pcloud/
- /home/zany130/.local/share/flatpak/
- /home/zany130/.local/share/gnome-boxes/
- /home/zany130/.local/share/Steam/steamapps/
- /home/zany130/.local/share/Trash/
- /home/zany130/.local/share/Zeal/
- /home/zany130/.steam/steam/steamapps/
- /home/zany130/.wine/dosdevices/
- /home/zany130/.var/
- /home/zany130/pCloudDrive/
- /home/zany130/Downloads/
- /home/zany130/Documents
- /home/zany130/GAMES/
- /home/zany130/Games/
- /home/zany130/Music/
- /home/zany130/Pictures/
- /home/zany130/Videos/
- /home/zany130/Rdiff/
- /home/zany130/snap
+ /home/zany130/.*
- /home/zany130/**
  1. would be a backup of Documents and other folders like that which I excluded in step 1. I Just sync those files to pcloud

  2. a list of packages that I have installed

this is the hard one and where I need help
from googling around it seems I can just do a

rpm --queryformat="%{NAME}.%{ARCH}\n" -qa | sort > new.list

and then restore it with
yum install `cat package.list
but this is going to include all packges including dependencies right? is there a better way to do this?

also how would I handle the diffrent repos I have?

3 Likes

There are so many ways of doing this.

I just keep a list of what I’d like to install and dump it all in a shell script:

I use deja-dup for backups but I don’t back up everything. In fact, I think of fresh installs as an opportunity to clean up all the useless bits I’ve collected over time :stuck_out_tongue_winking_eye:
I always upgrade to new releases—I haven’t had to fresh install in years, but in case I do have to, I have a separate /home partition that I just mount each time: if you use the same username during the fresh install, it will use the same user directory as before.

The dotfiles are managed by rcm

There are also lots of utilities that install lots of stuff for users. I’d personally avoid them unless you’ve had a chance to check what they do under the hood. I prefer throwing the commands into a quick shell script instead :slight_smile:

You could parse your dnf transactions from dnf history list, but i can’t think of a way of doing this easily. There’s no problem with also explicitly including the deps in your list—they’ll be installed by dnf anyway. If you only want to list the packages you used in the command and not the deps, I think you’re going to have to keep track of them like I do. I can’t think of a better way.

You can always back up your /etc/yum.repos.d folder where all your repository configurations are stored?

2 Likes

You might want to take a look at Ansible.

The easyest way would be to take a vanilla system, in a VM for instance, and install all components you want using ansible, thereby creating a playbook.

By maintaining this playbook, you will be able to deploy any new system the way you like.

2 Likes

Ansible or another orchestration tool would be ideal, but it may just be overkill for a smaller number of systems.

Also take a look at this topic where more orchestration tools were listed:

https://discussion.fedoraproject.org/t/need-more-gui-do-you-think-so/67200

3 Likes

I fully agree, but if you reach the point that you conviced yourself it is worth the effort to invest time to have every new installed system the way you want it, it doesn’t really matter what tool you use. So you might as well use a ‘powertool’ :grin:

3 Likes

Try dnf .

sudo dnf repoquery --userinstalled   --qf "%{NAME}" --exclude=$(sudo dnf  repoquery --extras --qf "%{NAME}"  | xargs  | sed -e "s/ /,/g"),kernel* |xargs >new.list


sudo dnf install $(cat new.list)  --skip-broken
3 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.