Files
fos/Buildroot/package/partclone/partclone-0.2.89.patch

96 lines
5.0 KiB
Diff

diff -rupN partclone-0.2.89_orig/fail-mbr/compile-mbr.sh partclone-0.2.89_new/fail-mbr/compile-mbr.sh
--- partclone-0.2.89_orig/fail-mbr/compile-mbr.sh 2017-08-10 20:20:27.659003090 -0400
+++ partclone-0.2.89_new/fail-mbr/compile-mbr.sh 2017-08-10 21:05:32.559055136 -0400
@@ -2,10 +2,10 @@
if dpkg-architecture -e amd64 || dpkg-architecture -e i386; then
# compile the file fail-mbr.bin
echo -n "Compiling: fail-mbr.S -> fail-mbr.o -> "
- gcc -Wall -Werror -m32 -nostdlib -o fail-mbr.o fail-mbr.S
+ gcc -no-pie -Wall -Werror -m32 -nostdlib -o fail-mbr.o fail-mbr.S
echo -n "fail-mbr.image -> "
- gcc -Os -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g -falign-jumps=1 -falign-loops=1 -falign-functions=1 -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -fno-dwarf2-cfi-asm -fno-asynchronous-unwind-tables -m32 -fno-stack-protector -mno-stack-arg-probe -Werror -Wno-trampolines -DUSE_ASCII_FAILBACK=1 -DHAVE_UNIFONT_WIDTHSPEC=1 -mrtd -mregparm=3 -fno-builtin -m32 -Wl,--build-id=none -nostdlib -Wl,-N,-S -Wl,-N -Wl,-Ttext,0x7C00 -o fail-mbr.image fail-mbr.o
+ gcc -no-pie -Os -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g -falign-jumps=1 -falign-loops=1 -falign-functions=1 -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -fno-dwarf2-cfi-asm -fno-asynchronous-unwind-tables -m32 -fno-stack-protector -mno-stack-arg-probe -Werror -Wno-trampolines -DUSE_ASCII_FAILBACK=1 -DHAVE_UNIFONT_WIDTHSPEC=1 -mrtd -mregparm=3 -fno-builtin -m32 -Wl,--build-id=none -nostdlib -Wl,-N,-S -Wl,-N -Wl,-Ttext,0x7C00 -o fail-mbr.image fail-mbr.o
echo "fail-mbr.bin [Done]. "
objcopy -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn fail-mbr.image fail-mbr.bin
diff -rupN partclone-0.2.89_orig/src/hfsplusclone.c partclone-0.2.89_new/src/hfsplusclone.c
--- partclone-0.2.89_orig/src/hfsplusclone.c 2017-08-10 20:20:27.695004471 -0400
+++ partclone-0.2.89_new/src/hfsplusclone.c 2017-08-10 20:21:39.197749892 -0400
@@ -130,7 +130,7 @@ extern void readbitmap(char* device, ima
UInt32 bused = 0, bfree = 0, mused = 0;
UInt32 block = 0, extent_block = 0, tb = 0;
int allocation_exten = 0;
- UInt32 allocation_start_block;
+ UInt64 allocation_start_block;
UInt32 allocation_block_size;
int start = 0;
int bit_size = 1;
diff -rupN partclone-0.2.89_orig/src/progress.c partclone-0.2.89_new/src/progress.c
--- partclone-0.2.89_orig/src/progress.c 2017-08-10 20:20:27.695004471 -0400
+++ partclone-0.2.89_new/src/progress.c 2017-08-10 20:32:48.839446103 -0400
@@ -182,6 +182,47 @@ static void calculate_speed(struct progr
strncpy(prog_stat->Rformated, Rformated, sizeof(prog_stat->Rformated));
}
+/// convert the size
+char* filesize_conv(double size, char *buf, size_t len) {
+ int i = 0;
+ const char* units[] = {"iB","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"};
+ while (size > 1024) {
+ size /= 1024;
+ i++;
+ }
+ snprintf(buf, len, "%.*f %s", i, size, units[i]);
+ return buf;
+}
+
+/// write data to log file for status/progress info
+void fogLogStatusFile(struct progress_bar *prog,struct prog_stat_t *prog_stat,unsigned long long current) {
+ FILE *fog_log;
+ fog_log = fopen("/var/log/status.fog","w");
+ if (fog_log == NULL) {
+ fprintf(stderr,"Error opening file %s","/var/log/status.log");
+ exit(0);
+ }
+ double totalsize=prog->block_size * prog->total;
+ double currentsize=prog->block_size * current;
+ int max_len=15;
+ char total_str[max_len];
+ char current_str[max_len];
+ char buf[max_len];
+ sprintf(total_str,filesize_conv(totalsize,buf,max_len));
+ sprintf(current_str,filesize_conv(currentsize,buf,max_len));
+ fprintf(fog_log,"%6.2f%s@%s@%s@%s@%s@%6.2f@%f\n",
+ prog_stat->speed,
+ prog_stat->speed_unit,
+ prog_stat->Eformated,
+ prog_stat->Rformated,
+ current_str,
+ total_str,
+ prog_stat->percent,
+ totalsize
+ );
+ fclose(fog_log);
+}
+
/// update information at progress bar
extern void progress_update(struct progress_bar *prog, unsigned long long copied, unsigned long long current, int done)
{
@@ -203,6 +244,7 @@ extern void progress_update(struct progr
fprintf(stderr, _(", %6.2f%s/min,"), prog_stat.speed, prog_stat.speed_unit);
if(prog->flag == IO)
fprintf(stderr, "\n\r%80c\rcurrent block: %10lld, total block: %10lld, Complete: %6.2f%%%s\r", clear_buf, current, prog->total, prog_stat.total_percent, "\x1b[A");
+ fogLogStatusFile(prog, &prog_stat, current);
} else {
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
@@ -278,6 +320,7 @@ extern void Ncurses_progress_update(stru
wrefresh(p_win);
wrefresh(bar_win);
wrefresh(tbar_win);
+ fogLogStatusFile(prog, &prog_stat, current);
} else {
mvwprintw(p_win, 0, 0, _("Total Time: %s Remaining: %s "), prog_stat.Eformated, prog_stat.Rformated);
if((prog->flag == IO) || (prog->flag == NO_BLOCK_DETAIL))