Tiny Core Linux
dCore Import Debian Packages to Mountable SCE extensions => dCore X86 => Topic started by: jls 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
-
/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.
-
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.
-
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.
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.
#!/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
-
Current behavior seems good to me.
-
am i wrong about the dir i mentioned is default for the distro? it's also a good place for keeping thinghs alltogheter
-
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.
-
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.
-
Ok, lets make it happen. :-)
-
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.
-
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.
-
I haven't started on it. Timestamp would mean unlimited possible different files. Below is the lines to create the dCore-*.gz timestamps:
#!/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 -
-
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.
-
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.
-
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.
-
hi jason,
how do you want to use the *.latest-information...?
i guess you want to give the backup-files the timestamp?
the downloaded files should be functional without any additional action.
a timestamp-backup-file is copied at every new download, so the core file is overwritten and a backup-timestamp-file created?
thank you for your help.
-
The date in the *.latest can be used to name backups, while the current is dCore-trusty.gz, or whichever port.
-
This is what i have so far, will probably submit tomorrow, version -c example:
tc@box:/usr/bin$ version -c
Warning:
You are running: dCore-jessie:2016.02.22.12.22
The latest release is: dCore-jessie:2016.02.19.16.43
Preferred dCore*.gz download path from /etc/sysconfig/boot_path:
/etc/sysconfig/tcedir/boot
Press Enter to download the most recent stable release, existing dCore*.gz
and *.md5.txt files will automatically be backed up, (q)uit to exit.
Connecting to repo.tinycorelinux.net (89.22.99.37:80)
dCore-jessie.gz.md5. 100% |*******************************| 50 0:00:00 ETA
Connecting to repo.tinycorelinux.net (89.22.99.37:80)
dCore-jessie.gz 100% |*******************************| 11656k 0:00:00 ETA
Downloaded: /etc/sysconfig/tcedir/boot/dCore-jessie.gz.md5.txt
/etc/sysconfig/tcedir/boot/dCore-jessie.gz
Ensure correct boot path, reboot to complete update.
I run RC to obviously version -c sees a different version above. Like before if you are already running the latest you see below, no download prompt.
tc@box:/usr/bin$ version -r
You are running dCore-jessie:2016.02.22.12.22, the latest release candidate.
Before downloading an updated version the specified boot partition is auto-mounted if necessary, provided the config file is properly modified and the partition is found in /etc/fstab. The existing dCore*gz and .md5.txt files will be moved/renamed like below, appended with the current running version. Unlimited backups can be kept based on partition space. There is currently no 'clean-up' functionality, so for now user will need to periodically clean out the old stuff when ready to delete.
tc@box:/usr/bin$ ll /etc/sysconfig/tcedir/boot/
total 23M
-rw-r--r-- 1 root root 12M Feb 24 02:04 dCore-jessie.gz
-rw-r--r-- 1 root root 12M Feb 24 02:00 dCore-jessie.gz.2016.02.22.12.22
-rw-r--r-- 1 root root 50 Feb 24 02:03 dCore-jessie.gz.md5.txt
-rw-r--r-- 1 root root 50 Feb 24 01:59 dCore-jessie.gz.md5.txt.2016.02.22.12.22
The config file is /etc/sysconfig/boot_path and the default download pathway is /etc/sysconfig/tcedir/boot/. Hopefully this will be acceptable, good for testing anyway. Further modifications can still be made and Jason's assistance might be required for anything fancier.
-
Draft done, will submit to Jason for review, appears to function well on one system :)
Added simple file check to confirm successful dCore*.gz and *.md5.txt download.
Successful dCore*.gz download creates a root owned /tmp/dCoreUpdateDownloadedReboot! file. It's presence prevents inadvertently re-downloading an update more than once during a session without reboot. Reboot to apply system update or simply delete this file from /tmp to play around and test.
tc@box:/tmp$ version -r
Warning:
You are running: dCore-jessie:2016.02.22.12.22
The latest release candidate is: dCore-jessie:2016.02.19.16.43
Update already downloaded to /etc/sysconfig/tcedir/boot,
confirm correct boot path, reboot system to complete update.
Only downloading once also prevents appending a backup file with the wrong version number. For example, downloading once correctly backs up the currently used dCore*.gz file with the current running version number. Downloading a second dCore*.gz file without reboot then incorrectly backs up a newer version dCore*.gz file with the current (now older) version number.
Jason knows cpio stuff to retrieve this information direct from the *.gz file but that's beyond me at present. Feel free to modify as desired. Hopefully this proposed system is adequate. If it tests okay great or it can be ammended, thanks.
-
Hopefully new version downloads are working okay, no news is good news.
Made some revisions and will submit to Jason for review shortly. Simple file check after download will either indicate download success or download fail for both the *.gz and md5 files. Also now an automated md5sum check, which ouputs the *gz.md5.txt for comparison to the actual md5sum.
tc@box:/mnt/sdb4/tce$ version -r
Warning:
You are running: dCore-jessie:2016.02.26.09.00
The latest release candidate is: dCore-jessie:2016.02.27.00.41
Preferred dCore*.gz download path from /etc/sysconfig/boot_path:
/mnt/sdb1/dCore/boot
Press Enter to download the most recent release candidate, existing dCore*.gz
and *.md5.txt files will automatically be backed up, (q)uit to exit.
Connecting to repo.tinycorelinux.net (89.22.99.37:80)
dCore-jessie.gz.md5. 100% |*******************************| 50 0:00:00 ETA
Connecting to repo.tinycorelinux.net (89.22.99.37:80)
dCore-jessie.gz 100% |*******************************| 11697k 0:00:00 ETA
Download success: /mnt/sdb1/dCore/boot/dCore-jessie.gz.md5.txt
Download success: /mnt/sdb1/dCore/boot/dCore-jessie.gz
Reported md5sum: 9b3e05e63b67eac0d88e17627be216fa
Actual md5sum: 9b3e05e63b67eac0d88e17627be216fa
Correct any errors, confirm boot path, reboot to complete update.
-
hi friends,
i have seen in nitrams post that there is a checksum-test in his routine.
###
Download success: /mnt/sdb1/dCore/boot/dCore-jessie.gz.md5.txt
Download success: /mnt/sdb1/dCore/boot/dCore-jessie.gz
Reported md5sum: 9b3e05e63b67eac0d88e17627be216fa
Actual md5sum: 9b3e05e63b67eac0d88e17627be216fa
Correct any errors, confirm boot path, reboot to complete update.
###
that feature would be really great for the core :-)
thank you for all your contributions.
-
netnomad the md5 check is already in the latest RCs.
Updated version script and /etc/sysconfig/boot_path config sent to Jason for review, hopefully will be released for testing. Now allows user to specify how many dCore*.gz and *.md5.txt backups to keep, any more are auto-purged during the update process once the new version was successfully downloaded. Default is 3 backups, change as desired. Without the updated boot_path config file the download directory will not display and you'll get the error below. Note the output now also displays the MAXBACKUPS setting.
dCore*.gz download path from /etc/sysconfig/boot_path (MAXBACKUPS = 3):
Not specified, create /etc/sysconfig/boot_path entry, exiting..
Then either remove boot_path from /opt/.filetool.lst and reboot to get the new config file or just cut/paste from below and re-configure:
boot_path config:
# Specify download directory for version -c or version -r dCore updates. The full dCore boot
# pathway must be specified (contains the dCore-*.gz and vmlinuz-* files). The version command
# automatically backs up the old dCore-*.gz and *.md5.txt file before downloading the update.
# Specify the maximum number of backups to store below. Reboot to complete the update.
# If this file is modified, add an /opt/.filetool.lst entry to save changes:
# etc/sysconfig/boot_path
# NO SPACES, ONLY ONE ENTRY FOR EACH OPTION
# BOOTPATH ENTRY MUST START WITH A SLASH
# BOOTPATH ENTRY MUST CONTAIN /mnt/* IF DOWNLOAD DIRECTORY IS NOT MOUNTED AFTER BOOT
# Note dCore uses the symlink 'tcedir' to point to the /tce directory. The dCore installer by default
# uses /etc/sysconfig/tcedir/boot, on the actual system this may be something like /mnt/sdb4/tce/boot.
# Use BOOTPATH=/* to specify dCore boot path directory:
#BOOTPATH=/etc/sysconfig/tcedir/boot
#BOOTPATH=/mnt/sdb4/tce/boot
BOOTPATH=/etc/sysconfig/tcedir/boot
# USE MAXBACKUPS=* to specify number of backups to keep:
#MAXBACKUPS=3
MAXBACKUPS=3
Note RCs 2016.02.28.23.36 and older don't need this yet, updating to the next RC won't need it yet, updating after that will require the new boot_path config.
Sorry for the hassles, learning as i go, should have provided a better config file at the start, thanks.