append
@@ -179,10 +179,10 @@ | ||
179 | 179 | GSList *RbSelectKNOPPIXSource2_group = NULL; |
180 | 180 | GtkWidget *RbSelectKNOPPIXSource1; |
181 | 181 | GtkWidget *BtnOrgKnoppixSelectInHDD; |
182 | - GtkWidget *cbxSourceFileList; | |
183 | 182 | GtkWidget *chkSourceFileDelete; |
184 | 183 | GtkWidget *BtnKNOPPIXSourceOK; |
185 | 184 | GtkWidget *BtnKNOPPIXSourceCancel; |
185 | + GtkWidget *cbxSourceFileList; | |
186 | 186 | |
187 | 187 | SetupWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
188 | 188 | gtk_window_set_title (GTK_WINDOW (SetupWindow), _("\345\205\203KNOPPIX\343\201\256\346\272\226\345\202\231")); |
@@ -220,12 +220,6 @@ | ||
220 | 220 | gtk_fixed_put (GTK_FIXED (fixed2), BtnOrgKnoppixSelectInHDD, 64, 176); |
221 | 221 | gtk_widget_set_size_request (BtnOrgKnoppixSelectInHDD, 112, 32); |
222 | 222 | |
223 | - cbxSourceFileList = gtk_combo_box_entry_new_text (); | |
224 | - gtk_widget_show (cbxSourceFileList); | |
225 | - gtk_fixed_put (GTK_FIXED (fixed2), cbxSourceFileList, 64, 32); | |
226 | - gtk_widget_set_size_request (cbxSourceFileList, 336, 28); | |
227 | - gtk_combo_box_append_text (GTK_COMBO_BOX (cbxSourceFileList), _("http://www.osakac.ac.jp/ecip/knoppix/knoppix_v5.0.1CD_20060601_xen3.0.2-20060710+IPAFont_AC20060712.client.tar.gz")); | |
228 | - | |
229 | 223 | chkSourceFileDelete = gtk_check_button_new_with_mnemonic (_("\350\247\243\345\207\215\345\276\214\343\200\201\343\203\200\343\202\246\343\203\263\343\203\255\343\203\274\343\203\211\343\203\225\343\202\241\343\202\244\343\203\253\343\202\222\345\211\212\351\231\244\343\201\231\343\202\213")); |
230 | 224 | gtk_widget_show (chkSourceFileDelete); |
231 | 225 | gtk_fixed_put (GTK_FIXED (fixed2), chkSourceFileDelete, 96, 64); |
@@ -241,6 +235,12 @@ | ||
241 | 235 | gtk_fixed_put (GTK_FIXED (fixed2), BtnKNOPPIXSourceCancel, 312, 256); |
242 | 236 | gtk_widget_set_size_request (BtnKNOPPIXSourceCancel, 100, 32); |
243 | 237 | |
238 | + cbxSourceFileList = gtk_combo_box_entry_new_text (); | |
239 | + gtk_widget_show (cbxSourceFileList); | |
240 | + gtk_fixed_put (GTK_FIXED (fixed2), cbxSourceFileList, 64, 32); | |
241 | + gtk_widget_set_size_request (cbxSourceFileList, 336, 28); | |
242 | + gtk_combo_box_append_text (GTK_COMBO_BOX (cbxSourceFileList), _("http://www.osakac.ac.jp/ecip/knoppix/knoppix_v5.0.1CD_20060601-20060614+IPAFont_AC20060623.orekno.tar.gz")); | |
243 | + | |
244 | 244 | g_signal_connect ((gpointer) BtnOrgKnoppixSelectInHDD, "clicked", |
245 | 245 | G_CALLBACK (on_BtnOrgKnoppixSelectInHDD_clicked), |
246 | 246 | NULL); |
@@ -258,10 +258,10 @@ | ||
258 | 258 | GLADE_HOOKUP_OBJECT (SetupWindow, RbSelectKNOPPIXSource2, "RbSelectKNOPPIXSource2"); |
259 | 259 | GLADE_HOOKUP_OBJECT (SetupWindow, RbSelectKNOPPIXSource1, "RbSelectKNOPPIXSource1"); |
260 | 260 | GLADE_HOOKUP_OBJECT (SetupWindow, BtnOrgKnoppixSelectInHDD, "BtnOrgKnoppixSelectInHDD"); |
261 | - GLADE_HOOKUP_OBJECT (SetupWindow, cbxSourceFileList, "cbxSourceFileList"); | |
262 | 261 | GLADE_HOOKUP_OBJECT (SetupWindow, chkSourceFileDelete, "chkSourceFileDelete"); |
263 | 262 | GLADE_HOOKUP_OBJECT (SetupWindow, BtnKNOPPIXSourceOK, "BtnKNOPPIXSourceOK"); |
264 | 263 | GLADE_HOOKUP_OBJECT (SetupWindow, BtnKNOPPIXSourceCancel, "BtnKNOPPIXSourceCancel"); |
264 | + GLADE_HOOKUP_OBJECT (SetupWindow, cbxSourceFileList, "cbxSourceFileList"); | |
265 | 265 | |
266 | 266 | return SetupWindow; |
267 | 267 | } |
@@ -2,6 +2,7 @@ | ||
2 | 2 | #include <string.h> |
3 | 3 | |
4 | 4 | #include "global.h" |
5 | +#include "swap.h" | |
5 | 6 | |
6 | 7 | |
7 | 8 |
@@ -10,8 +11,8 @@ | ||
10 | 11 | GtkWidget *CustomizeWindow; |
11 | 12 | GtkWidget *MakeImageWindow; |
12 | 13 | |
13 | -gchar* chProjectFolderPath[512]; | |
14 | -gchar* chSourceFilePath[512]; | |
14 | +gchar chProjectFolderPath[512]; | |
15 | +gchar chSourceFilePath[512]; | |
15 | 16 | |
16 | 17 | ///////////////////////////////////////////////////////////////////// |
17 | 18 | // |
@@ -29,42 +30,74 @@ | ||
29 | 30 | } |
30 | 31 | ///////////////////////////////////////////////////////////////////// |
31 | 32 | // |
33 | +gboolean ore_makeWgetShellScript(const gchar *pname,const gchar *url, | |
34 | + const gchar *pipe, const gchar *oraname) | |
35 | +{ | |
36 | + gchar fname[256],shell[1024]; | |
37 | + ore_swapwords swp; | |
38 | + GError *error=NULL; | |
39 | + | |
40 | + g_strlcpy(fname,pname,255); | |
41 | + g_strlcat(fname,"/wget.sh",255); | |
42 | + | |
43 | + ore_initswapwords(&swp); | |
44 | + | |
45 | + swp[0]=(gchar*)pname; | |
46 | + swp[1]=(gchar*)url; | |
47 | + swp[2]=(gchar*)pipe; | |
48 | + swp[3]=(gchar*)oraname; | |
49 | + | |
50 | + ore_strswap("wgetshellscript.template",shell,1024,swp); | |
51 | + | |
52 | + g_file_set_contents(fname,shell,strlen(shell),&error); | |
53 | + g_chmod(fname,0750); | |
54 | + | |
55 | + return TRUE; | |
56 | +} | |
57 | +///////////////////////////////////////////////////////////////////// | |
58 | +// | |
59 | +gboolean ore_makeTarShellScript(const gchar *pname,const gchar *target, | |
60 | + const gchar *pipe) | |
61 | +{ | |
62 | + gchar fname[256],shell[1024]; | |
63 | + ore_swapwords swp; | |
64 | + GError *error=NULL; | |
65 | + | |
66 | + g_strlcpy(fname,pname,255); | |
67 | + g_strlcat(fname,"/wget.sh",255); | |
68 | + | |
69 | + ore_initswapwords(&swp); | |
70 | + | |
71 | + swp[0]=(gchar*)pname; | |
72 | + swp[1]=(gchar*)url; | |
73 | + swp[2]=(gchar*)pipe; | |
74 | + swp[3]=(gchar*)oraname; | |
75 | + | |
76 | + ore_strswap("wgetshellscript.template",shell,1024,swp); | |
77 | + | |
78 | + g_file_set_contents(fname,shell,strlen(shell),&error); | |
79 | + g_chmod(fname,0750); | |
80 | + | |
81 | + return TRUE; | |
82 | +} | |
83 | +///////////////////////////////////////////////////////////////////// | |
84 | +// | |
32 | 85 | gboolean ore_makeShellScript(const gchar *pname) |
33 | 86 | { |
34 | - int i; | |
35 | - gchar fname[512],buff[512],nsv[512]; | |
87 | + gchar fname[256],shell[1024]; | |
88 | + ore_swapwords swp; | |
36 | 89 | GError *error=NULL; |
37 | 90 | |
38 | - for(i=0;i<512;i++){fname[i]=buff[i]=nsv[i]='\0';} | |
91 | + g_strlcpy(fname,pname,255); | |
92 | + g_strlcat(fname,"/into.sh",255); | |
39 | 93 | |
40 | - g_strlcpy(fname,pname,511); | |
41 | - g_strlcat(fname,"/into.sh",511); | |
42 | - g_strlcpy(buff,"#!/bin/sh\n",511); | |
43 | - g_strlcat(buff, | |
44 | - "NSV=`grep ^nameserver /etc/resolv.conf |" \ | |
45 | - "sed -e 's/nameserver \\(.*\\)/\\1/'`\n",511); | |
46 | - g_strlcat(buff,"for i in $NSV; do\n",511); | |
47 | - g_strlcat(buff,"echo \"nameserver $i #OREKNOPPIX\">>",511); | |
48 | - g_strlcat(buff,pname,511); | |
49 | - g_strlcat(buff,"/source/KNOPPIX/etc/resolv.conf\n",511); | |
50 | - g_strlcat(buff,"done\n",511); | |
51 | - //show message | |
52 | - g_strlcat(buff,"echo 'you should execute command!'\n",511); | |
53 | - g_strlcat(buff,"echo '\"mount -t proc proc /proc\"'\n\n",511); | |
54 | - g_strlcat(buff,"echo 'and you should execute command before " \ | |
55 | - "you exit chroot'",511); | |
56 | - g_strlcat(buff,"echo '\"umount /proc\"'\n",511); | |
94 | + ore_initswapwords(&swp); | |
57 | 95 | |
58 | - g_strlcat(buff,"chroot ",511); | |
59 | - g_strlcat(buff,pname,511); | |
60 | - g_strlcat(buff,"/source/KNOPPIX\n",511); | |
96 | + swp[0]=(gchar*)pname; | |
61 | 97 | |
62 | - g_file_set_contents(fname,buff,strlen(buff),&error); | |
98 | + ore_strswap("intoshellscript.template",shell,1024,swp); | |
63 | 99 | |
64 | - if(error!=NULL){ | |
65 | - g_error_free (error); | |
66 | - return FALSE; | |
67 | - } | |
100 | + g_file_set_contents(fname,shell,strlen(shell),&error); | |
68 | 101 | g_chmod(fname,0750); |
69 | 102 | |
70 | 103 | return TRUE; |
@@ -74,42 +107,63 @@ | ||
74 | 107 | gboolean ore_makeCLoopImageShellScript(const gchar *pname,gchar *title, |
75 | 108 | gchar *publisher) |
76 | 109 | { |
110 | + gchar fname[256],shell[1024]; | |
111 | + ore_swapwords swp; | |
112 | + GError *error=NULL; | |
113 | + | |
114 | + g_strlcpy(fname,pname,255); | |
115 | + g_strlcat(fname,"/makecloop.sh",255); | |
116 | + | |
117 | + ore_initswapwords(&swp); | |
118 | + | |
119 | + swp[0]=(gchar*)pname; | |
120 | + swp[1]=(gchar*)title; | |
121 | + swp[2]=(gchar*)publisher; | |
122 | + | |
123 | + ore_strswap("makecloopshellscript.template",shell,1024,swp); | |
124 | + | |
125 | + g_file_set_contents(fname,shell,strlen(shell),&error); | |
126 | + | |
127 | + g_chmod(fname,0750); | |
128 | + | |
129 | +/* | |
77 | 130 | int i; |
78 | - gchar fname[512],buff[512],nsv[512]; | |
131 | + const int STSIZE=512; | |
132 | + gchar fname[STSIZE],buff[STSIZE],nsv[STSIZE]; | |
79 | 133 | GError *error=NULL; |
80 | 134 | |
81 | - for(i=0;i<512;i++){fname[i]=buff[i]='\0';} | |
135 | + for(i=0;i<STSIZE;i++){fname[i]=buff[i]='\0';} | |
82 | 136 | |
83 | - g_strlcpy(fname,pname,511); | |
84 | - g_strlcat(fname,"/makecloop.sh",511); | |
85 | - g_strlcpy(buff,"#!/bin/sh\n\n",511); | |
86 | - g_strlcat(buff, "grep -v \"#OREKNOPPIX\" ",511); | |
87 | - g_strlcat(buff, pname,511); | |
88 | - g_strlcat(buff,"/source/KNOPPIX/etc/resolv.conf >",511); | |
89 | - g_strlcat(buff, pname,511); | |
90 | - g_strlcat(buff,"/source/KNOPPIX/etc/resolv.conf.bk\n",511); | |
91 | - g_strlcat(buff, "mv ",511); | |
92 | - g_strlcat(buff, pname,511); | |
93 | - g_strlcat(buff,"/source/KNOPPIX/etc/resolv.conf.bk ",511); | |
94 | - g_strlcat(buff, pname,511); | |
95 | - g_strlcat(buff,"/source/KNOPPIX/etc/resolv.conf\n",511); | |
96 | - g_strlcat(buff,"rm -rf ",511); | |
97 | - g_strlcat(buff, pname,511); | |
98 | - g_strlcat(buff,"/source/KNOPPIX/root/.bash*\n",511); | |
99 | - g_strlcat(buff,"rm -rf ",511); | |
100 | - g_strlcat(buff, pname,511); | |
101 | - g_strlcat(buff,"/source/KNOPPIX/tmp/*\n\n",511); | |
102 | - g_strlcat(buff,"mkisofs -R -U -hide-rr-moved -cache-inodes -no-bak \\\n",511); | |
103 | - g_strlcat(buff,"\t-V \"",511); | |
104 | - g_strlcat(buff,title,511); | |
105 | - g_strlcat(buff,"\" -publisher \"",511); | |
106 | - g_strlcat(buff,publisher,511); | |
107 | - g_strlcat(buff,"\" \\\n\t-pad ",511); | |
108 | - g_strlcat(buff,pname,511); | |
109 | - g_strlcat(buff,"/source/KNOPPIX \\\n",511); | |
110 | - g_strlcat(buff,"\t| nice -5 create_compressed_fs -b - 65536 > \\\n\t",511); | |
111 | - g_strlcat(buff,pname,511); | |
112 | - g_strlcat(buff,"/master/KNOPPIX/KNOPPIX\n",511); | |
137 | + g_strlcpy(fname,pname,STSIZE-1); | |
138 | + g_strlcat(fname,"/makecloop.sh",STSIZE-1); | |
139 | + g_strlcpy(buff,"#!/bin/sh\n\n",STSIZE-1); | |
140 | + g_strlcat(buff, "grep -v \"#OREKNOPPIX\" ",STSIZE-1); | |
141 | + g_strlcat(buff, pname,STSIZE-1); | |
142 | + g_strlcat(buff,"/source/KNOPPIX/etc/resolv.conf >",STSIZE-1); | |
143 | + g_strlcat(buff, pname,STSIZE-1); | |
144 | + g_strlcat(buff,"/source/KNOPPIX/etc/resolv.conf.bk\n",STSIZE-1); | |
145 | + g_strlcat(buff, "mv ",STSIZE-1); | |
146 | + g_strlcat(buff, pname,STSIZE-1); | |
147 | + g_strlcat(buff,"/source/KNOPPIX/etc/resolv.conf.bk ",STSIZE-1); | |
148 | + g_strlcat(buff, pname,STSIZE-1); | |
149 | + g_strlcat(buff,"/source/KNOPPIX/etc/resolv.conf\n",STSIZE-1); | |
150 | + g_strlcat(buff,"rm -rf ",STSIZE-1); | |
151 | + g_strlcat(buff, pname,STSIZE-1); | |
152 | + g_strlcat(buff,"/source/KNOPPIX/root/.bash*\n",STSIZE-1); | |
153 | + g_strlcat(buff,"rm -rf ",STSIZE-1); | |
154 | + g_strlcat(buff, pname,STSIZE-1); | |
155 | + g_strlcat(buff,"/source/KNOPPIX/tmp/*\n\n",STSIZE-1); | |
156 | + g_strlcat(buff,"mkisofs -R -U -hide-rr-moved -cache-inodes -no-bak \\\n",STSIZE-1); | |
157 | + g_strlcat(buff,"\t-V \"",STSIZE-1); | |
158 | + g_strlcat(buff,title,STSIZE-1); | |
159 | + g_strlcat(buff,"\" -publisher \"",STSIZE-1); | |
160 | + g_strlcat(buff,publisher,STSIZE-1); | |
161 | + g_strlcat(buff,"\" \\\n\t-pad ",STSIZE-1); | |
162 | + g_strlcat(buff,pname,STSIZE-1); | |
163 | + g_strlcat(buff,"/source/KNOPPIX \\\n",STSIZE-1); | |
164 | + g_strlcat(buff,"\t| nice -5 create_compressed_fs -b - 65536 > \\\n\t",STSIZE-1); | |
165 | + g_strlcat(buff,pname,STSIZE-1); | |
166 | + g_strlcat(buff,"/master/KNOPPIX/KNOPPIX\n",STSIZE-1); | |
113 | 167 | g_file_set_contents(fname,buff,strlen(buff),&error); |
114 | 168 | if(error!=NULL){ |
115 | 169 | g_error_free (error); |
@@ -116,6 +170,6 @@ | ||
116 | 170 | return FALSE; |
117 | 171 | } |
118 | 172 | g_chmod(fname,0750); |
119 | - | |
173 | +*/ | |
120 | 174 | return TRUE; |
121 | 175 | } |
@@ -90,7 +90,7 @@ | ||
90 | 90 | |
91 | 91 | bin_PROGRAMS = oreknoppix |
92 | 92 | |
93 | -oreknoppix_SOURCES = main.c support.c support.h interface.c interface.h callbacks.c callbacks.h global.c global.h | |
93 | +oreknoppix_SOURCES = main.c support.c support.h interface.c interface.h callbacks.c callbacks.h global.c global.h swap.c swap.h | |
94 | 94 | |
95 | 95 | |
96 | 96 | oreknoppix_LDADD = @PACKAGE_LIBS@ $(INTLLIBS) |
@@ -104,7 +104,8 @@ | ||
104 | 104 | CPPFLAGS = @CPPFLAGS@ |
105 | 105 | LDFLAGS = @LDFLAGS@ |
106 | 106 | LIBS = @LIBS@ |
107 | -oreknoppix_OBJECTS = main.o support.o interface.o callbacks.o global.o | |
107 | +oreknoppix_OBJECTS = main.o support.o interface.o callbacks.o global.o \ | |
108 | +swap.o | |
108 | 109 | oreknoppix_DEPENDENCIES = |
109 | 110 | oreknoppix_LDFLAGS = |
110 | 111 | CFLAGS = @CFLAGS@ |
@@ -119,7 +120,7 @@ | ||
119 | 120 | TAR = tar |
120 | 121 | GZIP_ENV = --best |
121 | 122 | DEP_FILES = .deps/callbacks.P .deps/global.P .deps/interface.P \ |
122 | -.deps/main.P .deps/support.P | |
123 | +.deps/main.P .deps/support.P .deps/swap.P | |
123 | 124 | SOURCES = $(oreknoppix_SOURCES) |
124 | 125 | OBJECTS = $(oreknoppix_OBJECTS) |
125 | 126 |
@@ -8,10 +8,14 @@ | ||
8 | 8 | extern GtkWidget *CustomizeWindow; |
9 | 9 | extern GtkWidget *MakeImageWindow; |
10 | 10 | |
11 | -extern gchar* chProjectFolderPath[512]; | |
12 | -extern gchar* chSourceFilePath[512]; | |
11 | +extern gchar chProjectFolderPath[512]; | |
12 | +extern gchar chSourceFilePath[512]; | |
13 | 13 | |
14 | 14 | gboolean ore_initParams(void); |
15 | +gboolean ore_makeWgetShellScript(const gchar *pname,const gchar *url, | |
16 | + const gchar *pipe,const gchar *orename); | |
17 | +gboolean ore_makeTarShellScript(const gchar *pname,const gchar *target, | |
18 | + const gchar *pipe); | |
15 | 19 | gboolean ore_makeShellScript(const gchar *pname); |
16 | 20 | gboolean ore_makeCLoopImageShellScript(const gchar *pname,gchar *title, |
17 | 21 | gchar *publisher); |
@@ -0,0 +1,64 @@ | ||
1 | +#include <gtk/gtk.h> | |
2 | +#include <string.h> | |
3 | + | |
4 | +#include "swap.h" | |
5 | + | |
6 | +gboolean ore_initswapwords(ore_swapwords *word) | |
7 | +{ | |
8 | + int i; | |
9 | + | |
10 | + if(word==NULL) return FALSE; | |
11 | + | |
12 | + for(i=0;i<10;i++){ | |
13 | + (*word)[i]=NULL; | |
14 | + } | |
15 | + return TRUE; | |
16 | +} | |
17 | +//////////////////////////////////////////////////////////////////////////// | |
18 | + | |
19 | + | |
20 | +gchar *ore_strswap(const gchar *filename,gchar *dest, | |
21 | + guint dest_len, ore_swapwords word) | |
22 | +{ | |
23 | + gint i,len; | |
24 | + gsize s; | |
25 | + gchar *buf,*b1,*b2,*t,*p; | |
26 | + | |
27 | + printf("swap %p\n",word[0]); | |
28 | + | |
29 | + | |
30 | + for(i=0;i<dest_len;i++) dest[i]='\0'; | |
31 | + | |
32 | + t=dest; | |
33 | + | |
34 | + //ファイル読み込み | |
35 | + if(!g_file_get_contents(filename,&buf,NULL,NULL)){ | |
36 | + return NULL; | |
37 | + } | |
38 | + b1=buf; | |
39 | + | |
40 | + while((b2=g_strstr_len(b1,-1,"#%"))!=NULL){ | |
41 | + | |
42 | + for(p=b1;p<b2;p++,t++){ *t=*p; } | |
43 | + b2++;b2++; | |
44 | + i=*b2-'0'; | |
45 | + b2++; | |
46 | + if(-1<i && i<10){ | |
47 | + if(word[i]!=NULL){ | |
48 | + g_strlcat(t,word[i],dest_len-1); | |
49 | + t+=strlen(word[i]); | |
50 | + } | |
51 | + } | |
52 | + else{ | |
53 | + *t++=*(b2-3); *t++=*(b2-2);*t++=*(b2-1); | |
54 | + } | |
55 | + b1=b2; | |
56 | + } | |
57 | + len=strlen(b1); | |
58 | + for(i=0;i<len;i++){*t++=b1[i];} | |
59 | + | |
60 | + //free | |
61 | + g_free(buf); | |
62 | + | |
63 | + return dest; | |
64 | +} |
@@ -7,6 +7,9 @@ | ||
7 | 7 | #include <string.h> |
8 | 8 | #include <sys/types.h> |
9 | 9 | #include <unistd.h> |
10 | +#include <fcntl.h> | |
11 | +#include <errno.h> | |
12 | +#include <limits.h> | |
10 | 13 | |
11 | 14 | #include "callbacks.h" |
12 | 15 | #include "interface.h" |
@@ -132,8 +135,9 @@ | ||
132 | 135 | on_BtnKNOPPIXSourceOK_clicked (GtkButton *button, |
133 | 136 | gpointer user_data) |
134 | 137 | { |
135 | - int pid; | |
136 | - gchar *url,*fname; | |
138 | + int pid,fifo,readed; | |
139 | + gchar *url=NULL,*fname=NULL; | |
140 | + gchar pipename[256],msg[512],procid[128]; | |
137 | 141 | gboolean delete; |
138 | 142 | GtkWidget *rb1; |
139 | 143 | GtkComboBox *cbx; |
@@ -143,28 +147,88 @@ | ||
143 | 147 | gdk_window_set_cursor(SetupWindow->window,cursor); |
144 | 148 | gtk_main_iteration(); |
145 | 149 | |
150 | + //make a named pipe | |
151 | + g_sprintf(pipename,"%s/.pipe.%d",chProjectFolderPath,rand()); | |
152 | + printf("pipename %s\n",pipename); | |
153 | + //exists? | |
154 | + if(!g_file_test(pipename,G_FILE_TEST_EXISTS)){ | |
155 | + if(mkfifo(pipename,0666)){ | |
156 | + printf("can't make pipe\n"); | |
157 | + goto pos1; | |
158 | + } | |
159 | + } | |
160 | + | |
161 | + //which select | |
146 | 162 | rb1=lookup_widget(GTK_WIDGET(button),"RbSelectKNOPPIXSource1"); |
147 | 163 | |
148 | 164 | if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rb1))){ |
165 | + //get url | |
149 | 166 | cbx=GTK_COMBO_BOX(lookup_widget(GTK_WIDGET(button),"cbxSourceFileList")); |
150 | 167 | url=gtk_combo_box_get_active_text(cbx); |
168 | + fname=g_path_get_basename(url); | |
151 | 169 | |
170 | + //setup script | |
171 | + ore_makeWgetShellScript( | |
172 | + (const gchar*)chProjectFolderPath, | |
173 | + url,pipename,fname); | |
174 | + | |
175 | + //process fork | |
152 | 176 | if( (pid=fork()) < 0) { goto pos1; } |
153 | 177 | if(pid==0){//child |
178 | + | |
154 | 179 | g_chdir(chProjectFolderPath); |
155 | - printf("wget %s\n",url); | |
156 | - execlp("wget","wget",url,NULL); | |
180 | + printf("wget...\n"); | |
181 | + execlp("wget.sh","wget.sh",NULL); | |
157 | 182 | exit(0); |
158 | 183 | } |
159 | - else{ wait(NULL); } | |
184 | + else{ | |
185 | + //for proc check | |
186 | + g_sprintf(procid,"/proc/%d",pid); | |
160 | 187 | |
188 | + printf("make pipe\n"); | |
189 | + fifo=open(pipename,O_RDONLY); | |
190 | + if(fifo==-1){ | |
191 | + printf("can't open pipe\n"); | |
192 | + goto pos1; | |
193 | + } | |
194 | + | |
195 | + do{ | |
196 | + memset(msg,'\0',sizeof(msg)); | |
197 | + readed=read(fifo,msg,511); | |
198 | + if(readed>0) printf("msg:%s\n",msg); | |
199 | + | |
200 | + //stack event pending? | |
201 | + if(gtk_events_pending()) gtk_main_iteration(); | |
202 | + | |
203 | + }while(g_file_test(procid,G_FILE_TEST_EXISTS)); | |
204 | + | |
205 | + printf("quit read pipe\n"); | |
206 | + wait(NULL); | |
207 | + } | |
208 | + close(fifo); | |
209 | + unlink(pipename); | |
210 | + } | |
211 | + else{ | |
212 | + //make tar script | |
213 | + | |
214 | + if( (pid=fork()) < 0) { goto pos1; } | |
215 | + if(pid==0){//child | |
216 | + g_chdir(chProjectFolderPath); | |
217 | + execlp("tar","tar","xfz",chSourceFilePath,NULL); | |
218 | + exit(0); | |
219 | + } | |
220 | + } | |
221 | + | |
222 | + | |
223 | + | |
224 | + | |
225 | + | |
161 | 226 | fname=g_path_get_basename(url); |
162 | 227 | |
163 | 228 | if( (pid=fork()) < 0) { goto pos1; } |
164 | 229 | if(pid==0){//child |
165 | 230 | g_chdir(chProjectFolderPath); |
166 | - printf("tar xfz %s\n",fname); | |
167 | - execlp("tar","tar","xfz",fname,NULL); | |
231 | + execlp("tar","tar","xfz",fname,"source","master",NULL); | |
168 | 232 | exit(0); |
169 | 233 | } |
170 | 234 | else{ wait(NULL); } |
@@ -181,19 +245,12 @@ | ||
181 | 245 | } |
182 | 246 | |
183 | 247 | pos1: |
184 | - g_free(url); | |
185 | - g_free(fname); | |
248 | + if(url!=NULL) g_free(url); | |
249 | + if(fname!=NULL) g_free(fname); | |
186 | 250 | } |
187 | - else{ | |
188 | - if( (pid=fork()) < 0) { goto pos1; } | |
189 | - if(pid==0){//child | |
190 | - g_chdir(chProjectFolderPath); | |
191 | - execlp("tar","tar","xfz",chSourceFilePath,NULL); | |
192 | - exit(0); | |
193 | - } | |
194 | - else{ wait(NULL); } | |
251 | +// else{ wait(NULL); } | |
195 | 252 | |
196 | - } | |
253 | +// } | |
197 | 254 | gdk_cursor_unref (cursor); |
198 | 255 | gtk_widget_destroy(SetupWindow); |
199 | 256 | } |
@@ -0,0 +1,12 @@ | ||
1 | +#ifndef ORE_SWAP | |
2 | +#define ORE_SWAP | |
3 | + | |
4 | +typedef gchar* ore_swapwords[10]; | |
5 | + | |
6 | +gboolean ore_initswapwords(ore_swapwords *word); | |
7 | + | |
8 | +gchar *ore_strswap(const gchar *filename,gchar *dest, | |
9 | + guint dest_len, ore_swapwords word); | |
10 | + | |
11 | +#endif | |
12 | + |
@@ -12,7 +12,8 @@ | ||
12 | 12 | support.c support.h \ |
13 | 13 | interface.c interface.h \ |
14 | 14 | callbacks.c callbacks.h \ |
15 | - global.c global.h | |
15 | + global.c global.h \ | |
16 | + swap.c swap.h | |
16 | 17 | |
17 | 18 | oreknoppix_LDADD = @PACKAGE_LIBS@ $(INTLLIBS) |
18 | 19 |
@@ -90,7 +90,7 @@ | ||
90 | 90 | |
91 | 91 | bin_PROGRAMS = oreknoppix |
92 | 92 | |
93 | -oreknoppix_SOURCES = main.c support.c support.h interface.c interface.h callbacks.c callbacks.h global.c global.h | |
93 | +oreknoppix_SOURCES = main.c support.c support.h interface.c interface.h callbacks.c callbacks.h global.c global.h swap.c swap.h | |
94 | 94 | |
95 | 95 | |
96 | 96 | oreknoppix_LDADD = -L/usr/X11R6/lib -L/usr -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXext -lXinerama -lXi -lXcursor -lXfixes -lpango-1.0 -lcairo -lXrender -lX11 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 $(INTLLIBS) |
@@ -104,7 +104,8 @@ | ||
104 | 104 | CPPFLAGS = |
105 | 105 | LDFLAGS = |
106 | 106 | LIBS = |
107 | -oreknoppix_OBJECTS = main.o support.o interface.o callbacks.o global.o | |
107 | +oreknoppix_OBJECTS = main.o support.o interface.o callbacks.o global.o \ | |
108 | +swap.o | |
108 | 109 | oreknoppix_DEPENDENCIES = |
109 | 110 | oreknoppix_LDFLAGS = |
110 | 111 | CFLAGS = -g -O2 |
@@ -119,7 +120,7 @@ | ||
119 | 120 | TAR = tar |
120 | 121 | GZIP_ENV = --best |
121 | 122 | DEP_FILES = .deps/callbacks.P .deps/global.P .deps/interface.P \ |
122 | -.deps/main.P .deps/support.P | |
123 | +.deps/main.P .deps/support.P .deps/swap.P | |
123 | 124 | SOURCES = $(oreknoppix_SOURCES) |
124 | 125 | OBJECTS = $(oreknoppix_OBJECTS) |
125 | 126 |