My backup script for dotfiles


#1

Hey,

I’m working on my own backup script for several of my dotfiles, and would like some idea to improve it / general feeling you have when using it. I also see it as a way to improve my scripting skill, don’t hesitate to shame me !

So far, i was considering adding more directory, leaving the choice to the user on which ones he wants to backup, making the git part optional…

You can find it on my github page :

Thanks fellow AL users :slight_smile:


#2

Thx , appreciated, merci !

Edit, thx for the hard work in there.


#3

Nice!

Tips, don’t use subshells $() for simple things that you can otherwise get right from bash alone, like whoami and pwd

For pwd it depends if you want the current working directory or the directory the script is in, for whoami you can check if UID/EUID is 0, however if you need the actual username whoami is likely the best option.

# in practice you wouldn't do this
# it's just as easy to do `(( UID == 0 )) && echo root` where needed
WHOAMI=$UID

# same as `pwd`
WHEREAMI="$PWD"

# script path, take the path that the script was invoked with: $0
# strip the trailing forward slash and filename of the script itself: %/*
WHEREAMI="${0%/*}"

#4

Shameless self plug, but you’re more than welcome to steal ideas from here


#5

Noted !

Haha no problems dude, gonna check it out later on :wink:
Thanks!


#6

In this thread we share a couple of scripts for backups. Thanks for sharing @gazeka74 !!


#7

Should have dig a bit in the forum so :persevere:
If you want to merge the threads it’s probably better ^^


#8

I don’t think it’s necessary. It was in case you could extract ideas. I have tried the script and I like it. Thanks again @gazeka74!


#9

Thanks gazeka74 for the sharing this!


#10

Thank you natemaia!
There are so many ideas to steal in your scripts, I really like looking in your repo as a noob coder there is always a good stuff to learn from.

Just a question about your tools like baph and others , is there a reason why you don’t put them in AUR instead of a specific repo for Archlabs ?


#11

Cheers @justme

I only add a select couple to the archlabs-scripts package as I’m already maintaining that anyway.

I’ve done AUR packaging before/still and it’s just not worth it for me. Don’t take this as a dick move, I just know that the audience for less known AUR packages is small and I’d rather spend that time on other things. If people really want to get my stuff they can grab them from one of my repos.

I also don’t update things very often or always keep them in sync, the place I update most often is the dotfiles repo (cause it’s automated :P) but even this can lag behind my local stuff, not optimal but w/e.

This doesn’t stop others from packaging my stuff if they like, most packages are not maintained by the author of the package contents.


#12

Thank you for the explanation mate, I can understand your position since there are a lot of people complaining for nothing, you don’t want to bother more than you need and I think you are right about it , you’ve already done a nice work here and may be before too idk.
I can’t and I won’t make any critizice about any of your decision, I am myself just a simple user who like to discover things that other people create.

And honestly I am pretty happy to dig into people’s repo, I find many good ideas it s a lot of research but I think I like that ^^

I have just a quick request to you … please don’t stop scripting in bash I enjoy reading it!
Thank you for your work you and all good ArchLaberz & ex-Crunchbangerz .
:slight_smile:


#13

Nate is a bloody god. A lot of talent, though he will never admit that. A humble dude. He’s my main man.