summarylogtreecommitdiffstats
path: root/modify_for_arch.patch
blob: 006cb69f5bd9465a8930b072795a6d8b09f3ff31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
diff -Naur a/program/functions.py b/program/functions.py
--- a/program/functions.py	2010-12-05 01:18:57.000000000 +0800
+++ b/program/functions.py	2017-01-31 15:43:03.677139199 +0800
@@ -54,10 +54,10 @@
 
 
 def check_package_install( pkg_name ):
-    a = commands.getoutput( 'dpkg -l' )
+    a = commands.getoutput( 'pacman -Q' )
     a = a.split( '\n' )
     for each in a:
-        if each[0:2] == 'ii' and each.split()[1] == pkg_name:
+        if each.split()[0] == pkg_name:
             return True
             
     return False
@@ -279,7 +279,7 @@
 def make_system_dirs( target_root ):
     print _('Making system dirs ...')
     errors = []
-    for each in ( '/proc', '/sys', '/tmp', '/mnt', '/media', '/media/cdrom0' ):
+    for each in ( '/run', '/dev', '/proc', '/sys', '/tmp', '/mnt', '/media', '/var/lib/systemd/coredump' ):
         tmp = commands.getstatusoutput( 'mkdir -p %s'%(target_root + each)  )
         if tmp[0] != 0:
             errors.append( _('Error occurred when mkdir %s , you need to make it manually.')%(target_root + each) )
@@ -326,7 +326,7 @@
 # devices that works even if disks are added and removed. See fstab(5).
 #
 # <file system> <mount point>   <type>  <options>       <dump>  <pass>
-proc            /proc           proc    nodev,noexec,nosuid 0       0
+# proc            /proc           proc    nodev,noexec,nosuid 0       0
 '''
     MPs = mp_config.keys()
     MPs.sort()
@@ -438,12 +438,17 @@
     defaultExcludes.append( '/proc' )
     defaultExcludes.append( '/sys' )
     defaultExcludes.append( '/tmp' )
+    defaultExcludes.append( '/run' )
+    defaultExcludes.append( '/dev' )
+    defaultExcludes.append( '/.snapshots' )
+    defaultExcludes.append( '/var/lib/systemd/coredump' )
+    defaultExcludes.append( '/home/*/.cache' )
+    defaultExcludes.append( '/home/*/.ccache' )
     defaultExcludes.append( '/mnt' )
     defaultExcludes.append( '/media' )
     
     defaultExcludes.append( '/boot/grub' )
     defaultExcludes.append( '/etc/fstab' )
-    defaultExcludes.append( '/etc/mtab' )
     defaultExcludes.append( '/etc/blkid.tab' )
     defaultExcludes.append( '/etc/udev/rules.d/70-persistent-net.rules' )
 
@@ -490,16 +495,16 @@
                 defaultExcludes.append( '/lib/modules/' + kernelVersion + '/volatile/' + each )
 
     # /var/cache/apt/archives/*.deb
-    contents = commands.getoutput( 'ls /var/cache/apt/archives | grep ".deb" ' )
+    contents = commands.getoutput( 'ls /var/cache/pacman/pkg ' )
     if contents:
         for each in contents.split('\n'):
-            defaultExcludes.append( '/var/cache/apt/archives/' + each )
+            defaultExcludes.append( '/var/cache/pacman/pkg/' + each )
     
     # /var/cache/apt/archives/partial/*
-    contents = commands.getoutput( 'ls /var/cache/apt/archives/partial/' )
-    if contents:
-        for each in contents.split('\n'):
-            defaultExcludes.append( '/var/cache/apt/archives/partial/' + each )
+    #contents = commands.getoutput( 'ls /var/cache/apt/archives/partial/' )
+    #if contents:
+    #    for each in contents.split('\n'):
+    #        defaultExcludes.append( '/var/cache/apt/archives/partial/' + each )
     
     return defaultExcludes
 
diff -Naur a/program/sh/install_grub.sh b/program/sh/install_grub.sh
--- a/program/sh/install_grub.sh	2010-07-14 12:53:44.000000000 +0800
+++ b/program/sh/install_grub.sh	2017-01-31 15:43:03.677139199 +0800
@@ -79,7 +79,7 @@
 
 
 echo "Generating grub.cfg ..."
-target_cmd "$target_dir" update-grub
+target_cmd "$target_dir" grub-mkconfig -o ./boot/grub/grub.cfg
 
 
 if [ $? -eq 0 ] ; then
diff -Naur a/program/ucloner_cmd.py b/program/ucloner_cmd.py
--- a/program/ucloner_cmd.py	2010-12-05 01:25:02.000000000 +0800
+++ b/program/ucloner_cmd.py	2017-01-31 15:43:03.677139199 +0800
@@ -130,7 +130,7 @@
         print 'functions.generate_fstab() done.'
         
     # 生成 mtab
-    tmp = commands.getstatusoutput( 'touch ' + target_dir+'/etc/mtab' )
+    tmp = commands.getstatusoutput( '[ -f '+target_dir+'/etc/mtabs ] || ln -s /proc/self/mounts '+target_dir+'/etc/mtab' )
     
     # 修复休眠功能
     ret = functions.fix_resume( target_dir, swappart )
@@ -249,7 +249,7 @@
             f.close()
             exList += text
     
-    exclusionListFile = './excludes'
+    exclusionListFile = '/tmp/ucloner_excludes'
     f = file(exclusionListFile, 'w')
     for each in exList:
         f.write( each.strip('\r \n') + '\n' )
diff -Naur a/program/ucloner_gui.py b/program/ucloner_gui.py
--- a/program/ucloner_gui.py	2010-12-28 14:00:35.000000000 +0800
+++ b/program/ucloner_gui.py	2017-01-31 15:46:49.536905266 +0800
@@ -31,6 +31,15 @@
 
 
 
+import re
+Distro_ID="Linux"
+with open('/etc/os-release') as f:
+    for line in f:
+        Distro_Obj = re.search(u'(?<=ID_LIKE=).+',line)
+        if Distro_Obj != None :
+            Distro_ID=Distro_Obj.group(0)
+            break
+
 
 
 
@@ -53,7 +62,9 @@
 
 
 
-
+def kill_mksquashfs():
+    os.kill(int(commands.getoutput("ps -ef|grep -P '\d\s+mksquashfs.*/tmp/ucloner_excludes'|head").split()[1]), signal.SIGKILL)
+    
 
 
 
@@ -336,6 +347,7 @@
         self.parent.set_sensitive(True)
         try:
             os.kill( self.id_subproc, signal.SIGKILL )
+            kill_mksquashfs()
         except:
             pass
 
@@ -343,6 +355,7 @@
     def stop_task(self, widget):
         try:
             os.kill( self.id_subproc, signal.SIGKILL )
+            kill_mksquashfs()
         except:
             pass
 
@@ -538,7 +551,7 @@
         self.button_browse.connect('clicked', self.on_button_browse_clicked )
         # 文件名
         self.entry_backup_filename = self.builder.get_object('entry_backup_filename')
-        self.entry_backup_filename.set_text( time.strftime('%Y-%m-%d_%H%M%S') + '.squashfs' )
+        self.entry_backup_filename.set_text( Distro_ID + "-" + time.strftime('%Y-%m-%d_%H%M%S') + '.squashfs' )
 
 
         # 底部按钮 
@@ -674,12 +687,14 @@
         self.parent.set_sensitive(True)
         try:
             os.kill( self.id_subproc, signal.SIGKILL )
+            kill_mksquashfs()
         except:
             pass
 
     def stop_task(self, widget):
         try:
             os.kill( self.id_subproc, signal.SIGKILL )
+            kill_mksquashfs()
         except:
             pass