- Timestamp:
- 07/28/09 18:23:40 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/linuxmuster-linbo/branches/testing/linbo/linbo_cmd.sh
r509 r510 200 200 .cloop - full block device (partition) image, cloop-compressed 201 201 accompanied by a .list file for quicksync 202 .rsync - incremental rsync batch, cloop-compressed202 .rsync - differential rsync batch, cloop-compressed 203 203 " 1>&2 204 204 } … … 702 702 # saves advanced ntfs attributes of partition mounted in /mnt 703 703 save_ntfs_attr(){ 704 # disabled 705 return 0 706 # echo -n "Sichere erweiterte NTFS Attribute ..." 707 echo "Sichere erweiterte NTFS Attribute ..." 704 echo -n "Sichere erweiterte NTFS Attribute ..." 708 705 local rootdev="$1" 709 # local i="" 710 # for i in acl attrib reparse_data; do 711 # echo -n " ${i} ..." 712 # (cd /mnt && getfattr -R -h -e hex -d -n "system.ntfs_${i}" * 2>/dev/null | gzip -c > ".${i}.gz") 713 # set_ntfs_admin_attr "/mnt/.${i}.gz" 714 # done 715 # security attributes 716 if umount /mnt; then 717 secaudit -b "$rootdev" 2>/dev/null | gzip -c > /tmp/.sec.gz 718 else 719 echo "Kann Partition $rootdev nicht aushängen!" 720 return 1 721 fi 722 if mountpart "$rootdev" /mnt -w ; then 723 mv /tmp/.sec.gz /mnt 724 set_ntfs_admin_attr "/mnt/.sec.gz" 725 else 726 echo "Kann Partition $rootdev nicht einhängen!" 727 return 1 728 fi 729 echo 706 local i="" 707 for i in acl attrib reparse_data; do 708 (cd /mnt && getfattr -R -h -e hex -d -n "system.ntfs_${i}" * 2>>/tmp/image.log | gzip -c > ".${i}.gz") 709 set_ntfs_admin_attr "/mnt/.${i}.gz" 710 done 711 echo " fertig." 730 712 } 731 713 … … 742 724 echo "Bereite Partition $2 (Größe=${size}K) für Komprimierung vor..." | tee -a /tmp/image.log 743 725 cleanup_fs /mnt 744 [ "$(fstype "$2")" = "ntfs" ] && save_ntfs_attr "$2" 726 # save extended ntfs attributes 727 [ "$(fstype "$2")" = "ntfs" ] && save_ntfs_attr 745 728 echo "Leeren Platz auffüllen mit 0en..." | tee -a /tmp/image.log 746 729 # Create nulled files of size 1GB, should work on any FS. … … 776 759 fi 777 760 ;; 778 incremental)761 differential) 779 762 if mountpart "$2" /mnt -w ; then 780 763 rmmod cloop >/dev/null 2>&1 … … 784 767 if mountpart /dev/cloop /cloop -r ; then 785 768 cleanup_fs /mnt 786 [ "$(fstype "$2")" = "ntfs" ] && save_ntfs_attr "$2" 769 # save extended ntfs attributes 770 [ "$(fstype "$2")" = "ntfs" ] && save_ntfs_attr 787 771 echo "Starte Kompression von $2 -> $3 (differentiell)." | tee -a /tmp/image.log 788 772 mkexclude … … 794 778 #rm -f "$TMP" 795 779 #interruptible rsync "$ROPTS" --exclude="/.linbo" --exclude-from="/tmp/rsync.exclude" --delete --delete-excluded --partial --only-write-batch="$3" /mnt/ /cloop 796 interruptible rsync "$ROPTS" --fake-super --exclude="/.linbo" --exclude-from="/tmp/rsync.exclude" --delete --delete-excluded --partial --log-file=/tmp/image.log --log-file-format="" --only-write-batch="$3" /mnt/ /cloop 2>&1 >>/tmp/image.log 780 #interruptible rsync "$ROPTS" --fake-super --exclude="/.linbo" --exclude-from="/tmp/rsync.exclude" --delete --delete-excluded --partial --log-file=/tmp/image.log --log-file-format="" --only-write-batch="$3" /mnt/ /cloop 2>&1 >>/tmp/image.log 781 interruptible rsync "$ROPTS" --exclude="/.linbo" --exclude-from="/tmp/rsync.exclude" --delete --delete-excluded --partial --log-file=/tmp/image.log --log-file-format="" --only-write-batch="$3" /mnt/ /cloop 2>&1 >>/tmp/image.log 797 782 RC="$?" 798 783 umount /cloop … … 909 894 910 895 911 # INCREMENTAL/Synced896 # differential/Synced 912 897 # sync_cloop imagefile targetdev 913 898 sync_cloop(){ … … 916 901 local RC=1 917 902 local ROPTS="-HaAX" 903 #local ROPTS="-a" 918 904 [ "$(fstype "$2")" = "vfat" ] && ROPTS="-rt" 919 905 if mountpart "$2" /mnt -w ; then … … 922 908 rm -f "$TMP" 923 909 # tschmitt: added logging parameter 924 interruptible rsync "$ROPTS" --fake-super --compress --partial --delete --log-file=/tmp/image.log --log-file-format="" --read-batch="$1" /mnt >"$TMP" 2>&1 ; RC="$?" 910 #interruptible rsync "$ROPTS" --fake-super --compress --partial --delete --log-file=/tmp/image.log --log-file-format="" --read-batch="$1" /mnt >"$TMP" 2>&1 ; RC="$?" 911 interruptible rsync "$ROPTS" --compress --partial --delete --log-file=/tmp/image.log --log-file-format="" --read-batch="$1" /mnt >"$TMP" 2>&1 ; RC="$?" 925 912 if [ "$RC" != "0" ]; then 926 913 cat "$TMP" >&2 | tee -a /tmp/image.log … … 944 931 #[ "$(fstype "$2")" = "vfat" ] && ROPTS="$ROPTS --inplace" 945 932 # tschmitt: added logging parameter 946 interruptible rsync "$ROPTS" --fake-super --partial --exclude="/.linbo" --exclude-from="/tmp/rsync.exclude" --delete --delete-excluded --log-file=/tmp/image.log --log-file-format="" /cloop/ /mnt >"$TMP" 2>&1 ; RC="$?" 933 #interruptible rsync "$ROPTS" --fake-super --partial --exclude="/.linbo" --exclude-from="/tmp/rsync.exclude" --delete --delete-excluded --log-file=/tmp/image.log --log-file-format="" /cloop/ /mnt >"$TMP" 2>&1 ; RC="$?" 934 interruptible rsync "$ROPTS" --partial --exclude="/.linbo" --exclude-from="/tmp/rsync.exclude" --delete --delete-excluded --log-file=/tmp/image.log --log-file-format="" /cloop/ /mnt >"$TMP" 2>&1 ; RC="$?" 947 935 umount /cloop 948 936 if [ "$RC" != "0" ]; then … … 1080 1068 # restore NTFS attributes: rootdev 1081 1069 restore_ntfs_attr(){ 1082 # disabled1083 return 01084 local rootdev="$1"1085 1070 # don't restore attributes if a complete cloop restore without rsync afterwards was done 1086 1071 if [ -e /tmp/.cloop ]; then … … 1088 1073 return 0 1089 1074 fi 1090 # echo -n "Restauriere erweiterte NTFS Attribute ..." 1091 # local i="" 1092 # for i in acl attrib reparse_data; do 1093 # [ -f "/mnt/.${i}.gz" ] || continue 1094 # echo -n " $i ..." 1095 # (cd /mnt && zcat ".${i}.gz" | setfattr --restore=- 2>> /tmp/image.log) 1096 # set_ntfs_admin_attr "/mnt/.${i}.gz" 1097 # done 1098 # restore security attributes 1099 if [ -f "/mnt/.sec.gz" ]; then 1100 echo "Restauriere erweiterte NTFS Attribute ..." 1101 cp /mnt/.sec.gz /tmp || return 1 1102 if umount /mnt; then 1103 zcat /tmp/.sec.gz | secaudit -s "$rootdev" 2&1>> /tmp/image.log 1104 mountpart "$rootdev" /mnt -w 1105 rm -f /tmp/.sec.gz 1106 set_ntfs_admin_attr "/mnt/.sec.gz" 1107 else 1108 echo "Kann Partition $rootdev nicht aushängen!" 1109 return 1 1110 fi 1111 fi 1112 sync 1113 # echo 1075 echo -n "Restauriere erweiterte NTFS Attribute ..." 1076 local i="" 1077 for i in acl attrib reparse_data; do 1078 [ -f "/mnt/.${i}.gz" ] || continue 1079 (cd /mnt && zcat ".${i}.gz" | setfattr --restore=- 2>> /tmp/image.log) 1080 set_ntfs_admin_attr "/mnt/.${i}.gz" 1081 done 1082 echo " Fertig." 1114 1083 } 1115 1084 … … 1159 1128 if [ -e /mnt/[Nn][Tt][Ll][Dd][Rr] -o -e /mnt/[Bb][Oo][Oo][Tt][Mm][Gg][Rr] ]; then 1160 1129 # tschmitt: logging 1161 echo "Patche System mit $patchfile" >/tmp/patch.log1130 echo -n "Patche System mit $patchfile ... " >/tmp/patch.log 1162 1131 cat "$TMP" >>/tmp/patch.log 1163 1132 patch_registry "$TMP" /mnt 2>&1 >>/tmp/patch.log 1164 1133 [ -e /tmp/output ] && cat /tmp/output >>/tmp/patch.log 1134 echo "Fertig." 1165 1135 [ "$(fstype "$5")" = "vfat" ] && ms-sys -2 "$5" 1166 1136 elif [ -e /mnt/[Ii][Oo].[Ss][Yy][Ss] ]; then … … 1171 1141 rm -f "$TMP" 1172 1142 fi 1173 # restore NTFS attributes1174 [ "$(fstype "$rootdev")" = "ntfs" ] && restore_ntfs_attr "$rootdev"1175 1143 # patching for linux systems 1176 1144 # hostname … … 1183 1151 # fstab 1184 1152 [ -f /mnt/etc/fstab ] && patch_fstab "$rootdev" 1153 # restore extended ntfs attributes 1154 [ "$(fstype "$5")" = "ntfs" ] && restore_ntfs_attr 1185 1155 sync; sync; sleep 1 1186 1156 umount /mnt || umount -l /mnt … … 1218 1188 # RC=1 1219 1189 # else 1220 mk_cloop incremental "$5" "$2" "$3" ; RC="$?"1190 mk_cloop differential "$5" "$2" "$3" ; RC="$?" 1221 1191 # fi 1222 1192 ;;
Note: See TracChangeset
for help on using the changeset viewer.
