Tiny Core Linux
Tiny Core Extensions => TCE Q&A Forum => Topic started by: bigpcman on January 17, 2010, 03:29:06 PM
-
In the past I created custom backup file tce extensions by simply using tar and renaming the file to ".tce".
Now I would like to do the same thing (load files to RAM on boot) using the "new" approach in tc v2.8rc3.
I get how to use the copy2fs.flg and copy2fs.lst but I'm not clear on how to create the tcz. Are these the right steps?
mkdir /tmp/package
cp all backup files to /tmp/package
cd /tmp/package
mksquashfs package backup_name.tcz
mv backup_name.tcz ../tce/optional
ln -s ../tce/backup_name.tcz ../tce/optional/backup_name.tcz
-
The ln command has them the wrong way around, it should be "ln target linkname".
Otherwise that's it.
-
The ln command has them the wrong way around, it should be "ln target linkname".
Otherwise that's it.
I always seem to do that. Thanks
-
No, it is 'ln source destination'.
-
No, it is 'ln source destination'.
After thinking about it I missed an obvious part of the process. The backup files need to have destinations established via a list! So here's another crack at what I think is required:
# Establish file backup list using tc builtin tool - add files one by one.
/usr/bin/add2file /tmp/backup_name.lst
# Create tar file from the list.
tar -C / -T /tmp/backup_name.lst -zcf /tmp/backup_name.tar.gz
mkdir /tmp/package
# unpack the tar in package/.
tar -xf /tmp/backup_name.tar.gz -C /tmp/package
# Create tcz file
mksquashfs /tmp/package backup_name.tcz
# Move the tcz and create link
mv /opt/package/backup_name.tcz ../tce/optional
ln -s ../tce/optional/backup_name.tcz ../tce/backup_name.tcz
-
There is no need to pack and unpack the files using tar; cpio in pass-through mode will copy files based on a list that is either in a file or is generated by a program such as find.
If you install GNU cpio (cpio.tcz), then the following should work assuming each file path begins with "/"
cpio -pud /tmp/package </tmp/backup-name.lst
Busybox (or GNU) cpio will work if you remove the initial "/" from each file path and execute
( cd / ; cpio -pud /tmp/package </tmp/backup-name.lst )
(Busybox cpio's pass-through mode handling of paths beginning with "/" will be fixed in an upcoming release.)
Also, you need to be in directory /tmp when you invoke mksquashfs if you refer to the directory as "package".
-
There is no need to pack and unpack the files using tar; cpio in pass-through mode will copy files based on a list that is either in a file or is generated by a program such as find.
If you install GNU cpio (cpio.tcz), then the following should work assuming each file path begins with "/"
cpio -pud /tmp/package </tmp/backup-name.lst
Busybox (or GNU) cpio will work if you remove the initial "/" from each file path and execute
( cd / ; cpio -pud /tmp/package </tmp/backup-name.lst )
(Busybox cpio's pass-through mode handling of paths beginning with "/" will be fixed in an upcoming release.)
Also, you need to be in directory /tmp when you invoke mksquashfs if you refer to the directory as "package".
Thanks for the tip. I have not been able to get busybox cpio to work. I tried:
root@box:/tmp# cat backup.lst
home/tc/.Xauthority
home/tc/.Xdefaults
home/tc/.ash_history
root@box:/tmp# cpio -pud package < backup.lst
cpio: home/tc/.Xauthority: No such file or directory
and
root@box:/tmp# cpio -pud /tmp/package < /tmp/ backup.lst
In all cases no files are transfered to /tmp/package.
I'll try ( cd / ; cpio -pud /tmp/package </tmp/backup-name.lst ) next.
-
Thanks for the tip. I have not been able to get busybox cpio to work. I tried:
root@box:/tmp# cat backup.lst
home/tc/.Xauthority
home/tc/.Xdefaults
home/tc/.ash_history
root@box:/tmp# cpio -pud package < backup.lst
cpio: home/tc/.Xauthority: No such file or directory
and
root@box:/tmp# cpio -pud /tmp/package < /tmp/ backup.lst
In all cases no files are transfered to /tmp/package.
I'll try ( cd / ; cpio -pud /tmp/package </tmp/backup-name.lst ) next.
If a file's path does not begin with "/", then cpio fetches the file relative to the current working directory. Since you executed cpio in /tmp, you were telling cpio to fetch files from /tmp/home/tc/..., which does not exit. Thus you need to use
( cd / ; cpio -pud ... )
so cpio executes in a subshell with "/" as its working directory. (Using a subshell makes the change to "/" temporary for that command sequence.)
-
If a file's path does not begin with "/", then cpio fetches the file relative to the current working directory. Since you executed cpio in /tmp, you were telling cpio to fetch files from /tmp/home/tc/..., which does not exit. Thus you need to use
( cd / ; cpio -pud ... )
so cpio executes in a subshell with "/" as its working directory. (Using a subshell makes the change to "/" temporary for that command sequence.)
Thank you vitex for that clarification. So perhaps this will work better for creating a tcz.
# Establish file backup list using tc builtin tool - add files one by one.
/usr/bin/add2file /tmp/backup_name.lst
# copy files with full path intact
( cd / ; cpio -pud /tmp/package < /tmp/backup_name.lst )
# Create tcz file
cd /tmp
mksquashfs package backup_name.tcz
# Move the tcz and create link
mv /tmp/package/backup_name.tcz ../tce/optional
ln -s ../tce/optional/backup_name.tcz ../tce/backup_name.tcz
All of this should be done as root user.
edit: I removed the "mkdir /tmp/package" command since cpio does this automatically. Also removed the erroneous leading cd /tmp.