Welcome
Welcome to refracta

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

(SOLVED) md5 creation without absolute path

Stuff that has not yet gone into the official build.

(SOLVED) md5 creation without absolute path

Postby vsido » Sun Feb 15, 2015 3:16 pm

I need to have an md5 created that does not use the absolute path ... I would like this as a request but if there are reasons the absolute path is needed I can live with it..
This is how it is currently created in the script

Code: Select all
   if [[ $make_md5sum = "yes" ]]; then
      md5sum "$snapshot_dir"/"$filename" > "$snapshot_dir"/"$filename".md5
   fi


I thought this simple change would do the trick, but it does not create the md5

Code: Select all
   if [[ $make_md5sum = "yes" ]]; then
      md5sum "$filename" > "$filename".md5
   fi


or would it be this?

Code: Select all
   if [[ $make_md5sum = "yes" ]]; then
      md5sum $filename > $filename.md5
   fi


(Off to test that last one)
Last edited by vsido on Mon Feb 16, 2015 12:05 am, edited 1 time in total.
User avatar
vsido
 
Posts: 90
Joined: Fri Jan 30, 2015 3:38 pm

Re: md5 creation without absolute path

Postby vsido » Sun Feb 15, 2015 3:57 pm

The last one failed also... everything builds fine, just the md5 file is not created

Any suggestions?
User avatar
vsido
 
Posts: 90
Joined: Fri Jan 30, 2015 3:38 pm

Re: md5 creation without absolute path

Postby fsmithred » Sun Feb 15, 2015 5:56 pm

md5sum command needs to know where the file is that it's going use. You can tell it to put the resulting .md5 file wherever you want. The way it is in the script, it puts both the iso and the md5 file in the snapshot directory, which is excluded from the rsync copy. (It sucks when you get this wrong, and your snapshots contain other snapshots or extra copies of the entire filesystem.)
Code: Select all
   if [[ $make_md5sum = "yes" ]]; then
      md5sum "$snapshot_dir"/"$filename" > "$filename".md5
   fi


The above will put the .md5 file in $work_dir (/home/work by default) because the script changes to the work directory before it starts doing things. So if you want to use relative directories, take that into account.

Why do you want to change this? What are you trying to do?
User avatar
fsmithred
 
Posts: 2089
Joined: Wed Mar 09, 2011 9:13 pm

Re: md5 creation without absolute path

Postby vsido » Sun Feb 15, 2015 6:31 pm

These ISO's are distributed ...

When there are absolute paths in the md5, the md5 checksum fail .... because there is no /home/snapshot on another users machine

I have scripts that also wget and move the files to another torrent server that checks automatically for the md5 verification and with the absolute path there these scripts also fail

I have to manually edit each .md5 file afterwards and remove the /home/snapshot references. It is just a step I am trying to eliminate

I thought I did try this one as my first test (it is the most obvious)

Code: Select all
   if [[ $make_md5sum = "yes" ]]; then
      md5sum "$snapshot_dir"/"$filename" > "$filename".md5
   fi


But will test it again to verify
User avatar
vsido
 
Posts: 90
Joined: Fri Jan 30, 2015 3:38 pm

Re: md5 creation without absolute path

Postby vsido » Sun Feb 15, 2015 7:18 pm

Verified... those settings fail to create a md5 file also
User avatar
vsido
 
Posts: 90
Joined: Fri Jan 30, 2015 3:38 pm

Re: md5 creation without absolute path

Postby fsmithred » Sun Feb 15, 2015 8:17 pm

This should do it.
Code: Select all
if [[ $make_md5sum = "yes" ]]; then
    cd "$snapshot_dir"
    md5sum $filename" > "$filename".md5
    cd "$work_dir"
fi
User avatar
fsmithred
 
Posts: 2089
Joined: Wed Mar 09, 2011 9:13 pm

Re: md5 creation without absolute path

Postby vsido » Sun Feb 15, 2015 9:17 pm

That worked as expected... Thank you kind sir..!

I have never seen a path included in an .md5 file before, what is the reasoning behind it? Wouldn't that restrict the success of any md5sum check unless it was run from the path that is in that file? Just curious
User avatar
vsido
 
Posts: 90
Joined: Fri Jan 30, 2015 3:38 pm

Re: md5 creation without absolute path

Postby fsmithred » Sun Feb 15, 2015 9:59 pm

I never thought about the path in the file. If I need to check the md5sum after copying, I just run md5sum on the file and look inside the .md5 file to compare. The md5 files I have in some of the download directories are created on the server in an ssh session, so there's no path. I just redirect the output to append the md5 file, which contains a two-column list of md5sums and filenames.

Anyway, it was a good suggestion, and it's in the next build.
User avatar
fsmithred
 
Posts: 2089
Joined: Wed Mar 09, 2011 9:13 pm

Re: (SOLVED) md5 creation without absolute path

Postby vsido » Mon Feb 16, 2015 12:06 am

Thanks for the explanation and the quick turnaround, it is much appreciated
User avatar
vsido
 
Posts: 90
Joined: Fri Jan 30, 2015 3:38 pm

Re: md5 creation without absolute path

Postby jedi » Mon Feb 16, 2015 6:10 am

fsmithred wrote:Anyway, it was a good suggestion, and it's in the next build.


Wow! Thanks so much fsmithred! VastOne is one heck of a dev and it's nice to see Refracta obviously has the same! I see in his posts he is vsido... VastOne = vsido The VSIDO SID based distribution created by VastOne!

Your quick responses so far to anything VSIDO has asked of you is very uplifting to say the least. If there is anything you might need that we've already encountered, we love to share! FOSS rules...
No matter how smart you are you can never convince someone stupid that they are stupid.
User avatar
jedi
 
Posts: 7
Joined: Mon Feb 16, 2015 5:39 am
Location: Earth, usually...


Return to Experimental

Who is online

Users browsing this forum: No registered users and 1 guest

suspicion-preferred