WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: "version" command download location  (Read 5732 times)

Offline jls

  • Hero Member
  • *****
  • Posts: 2135
"version" command download location
« on: February 22, 2016, 04:21:15 AM »
Hi
At the moment the script downloads the new initrd under /tmp, what about downloading it under tcedir/boot, since that is the default location of the distro install script?
Thanks
dCore user

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: "version" command download location
« Reply #1 on: February 22, 2016, 07:35:54 AM »
/tmp made sense at the time as users probably use different boot directories. I didn't realize there was an installer default - oops :)

Keeping it in /tmp may reduce disk writes for users like me not utilizing the default boot directory?

I've been using my own rcupdate script to call  version -r  and copy dCore updates from /tmp to my boot directory, just press Enter and reboot. Is there a way for the system to automagically know the dCore boot partition and directory? If so then the version script could be updated to automatically download dCore updates directly to the user's actual boot directory and create a backup copy of the existing file.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: "version" command download location
« Reply #2 on: February 22, 2016, 09:29:56 AM »
I have my *.gz and vmlinuz under /mnt/sda2/boot, but grub is installed to /mnt/sda3/boot/.   Once running, I don't think there is a way to know which partition the active boot directory resides on.  One alternative could be to download to ~/Downloads, but I am good either way. 

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: "version" command download location
« Reply #3 on: February 22, 2016, 10:21:13 AM »
Once running, I don't think there is a way to know which partition the active boot directory resides on.
Think you are correct. The only way might be if the version script either asks user to manually enter desired boot pathway before downloading or else create a new single line config file in /etc/sysconfig whereby user enters desired download path. The version script could be modified to read the config file, mount the designated partition, backup the existing dCore file and download the new version to the designated pathway, similar to below.

Quote
One alternative could be to download to ~/Downloads, but I am good either way.
That would create a very large backup if user doesn't have persistent home and forgets to delete the download.


Code: [Select]
#!/bin/busybox ash

PARTITION="/mnt/sdb1"
BOOTDIR="/mnt/sdb1/dCore/boot"

echo "dCore update check..."
echo " "
echo "If no immediate exit press Enter to download and install update. "
echo

if version -r | grep "the latest release candidate."; then
exit
else
mount "$PARTITION" >/dev/null 2>&1
cd "$BOOTDIR"
if [ -f *.md5.txt ]; then
sudo rm *.md5.txt
fi
if [ -f *.old ]; then
sudo rm *.old
fi
GZ=$(ls | grep dCore*.gz)
sudo mv -f "$GZ" "$GZ".old
sudo cp -f /tmp/release_candidate/* "$BOOTDIR"
echo " "
echo "Update installed, outdated "$GZ" file backed up as"
echo ""$GZ".old. Reboot system to apply update."
fi


Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: "version" command download location
« Reply #4 on: February 22, 2016, 11:23:51 AM »
Current behavior seems good to me.

Offline jls

  • Hero Member
  • *****
  • Posts: 2135
Re: "version" command download location
« Reply #5 on: February 22, 2016, 11:47:39 AM »
am i wrong about the dir i mentioned is default for the distro? it's also a good place for keeping thinghs alltogheter
« Last Edit: February 22, 2016, 11:49:26 AM by jls »
dCore user

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: "version" command download location
« Reply #6 on: February 22, 2016, 01:22:39 PM »
Ah, tcedir/boot, I was thinking just boot. tcedir/boot sounds like a good default place, and an entry in sceconfig would let folks put it where they want, and can specify the true boot directory so would not have to be copied to it at all. 

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: "version" command download location
« Reply #7 on: February 22, 2016, 05:40:12 PM »
tcedir/boot sounds like a good default place, and an entry in sceconfig would let folks put it where they want, and can specify the true boot directory so would not have to be copied to it at all.
That would definitely get my vote, default to /tcedir/boot unless config file specifies otherwise.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: "version" command download location
« Reply #8 on: February 22, 2016, 07:23:57 PM »
Ok, lets make it happen.  :-)

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: "version" command download location
« Reply #9 on: February 23, 2016, 01:12:20 AM »
If someone has already started on this please let me know, otherwise will try to submit a test version within a week or so, need to do some more learning, thanks.

Offline netnomad

  • Hero Member
  • *****
  • Posts: 1026
Re: "version" command download location
« Reply #10 on: February 23, 2016, 02:14:32 AM »
hi friends,

keeping backups seems to be a good thing for me... configurations and even core system files...
would you mind to rename the existing files for keeping them, instead of simply overwriting them?
i really appreciate the backdate.sh that offers me a history of my config-backups :-)
f.e. the last ten versions numbered for 01 to 10... or with a timestamp-extension... or do you prefer version?

thank you for your interest and help.
« Last Edit: February 23, 2016, 02:17:05 AM by netnomad »

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: "version" command download location
« Reply #11 on: February 23, 2016, 05:40:57 AM »
I haven't started on it.  Timestamp would mean unlimited possible different files.  Below is the lines to create the dCore-*.gz timestamps:

Code: [Select]
#!/bin/sh

CORE="$1"
REPO=`cat rootfs/usr/share/doc/tc/repo.txt`
RELEASE=`echo dCore-"$REPO":$(date "+%Y.%m.%d.%H.%M")`
echo "$RELEASE" > rootfs/usr/share/doc/tc/release.txt
echo "$RELEASE" > dCore-"$REPO".latest
cd rootfs

find | cpio -o -H newc | gzip -2 > ../"$CORE"
cd ..
md5sum "$CORE" > "$CORE".md5.txt

cd -


Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: "version" command download location
« Reply #12 on: February 23, 2016, 09:30:21 AM »
Have a working version script and config file prototype that allows downloading to any directory, mount partition as needed, unlimited datestamp backup. Hope to spend time polishing next couple days then submit for review. Only have one dCore system for testing, so may take a bit to work out bugs after release, thanks.

Offline netnomad

  • Hero Member
  • *****
  • Posts: 1026
Re: "version" command download location
« Reply #13 on: February 23, 2016, 11:38:43 AM »
hi friends,

backups with timestamp-extensions is a good solution,
but the alternative with the version-extension could be even better...
f.e. dupes are avoided, evaluation is easier.
is there a way to read the version out of the plain dCore-*.gz-file?
this would offer advantages for rollbacks and for recognizing unloaded plain dCore-*.gz-files...

thank you for your considerations.

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: "version" command download location
« Reply #14 on: February 23, 2016, 10:42:52 PM »
Oh, is the date stamp going to come from http://tinycorelinux.net/dCore/x86/release_candidates/dCore-trusty/dCore-trusty.latest?  If so, the script can check to see if that file has already been downloaded and no need to again.