Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 114713
Collapse All | Expand All

(-)/usr/lib/portage/bin/etc-update.old (-10 / +87 lines)
Lines 9-14 Link Here
9
# Jochem Kossen <j.kossen@home.nl>
9
# Jochem Kossen <j.kossen@home.nl>
10
# Leo Lipelis <aeoo@gentoo.org>
10
# Leo Lipelis <aeoo@gentoo.org>
11
# Karl Trygve Kalleberg <karltk@gentoo.org>
11
# Karl Trygve Kalleberg <karltk@gentoo.org>
12
#
13
# Watch list support by:
14
# Alessandro Di Marco <dmr@disi.unige.it>
15
# Paolo Gianrossi <gianrossi@disi.unige.it>
12
16
13
export PORTAGE_CALLER="etc-update"
17
export PORTAGE_CALLER="etc-update"
14
18
Lines 97-115 Link Here
97
101
98
function sel_file() {
102
function sel_file() {
99
	local -i isfirst=0
103
	local -i isfirst=0
104
	local -i i=0
105
	local watch=""
106
107
	if [ -f "/etc/etc-update.watch" ] ; then
108
		local esc="\\\\\/"
109
	
110
		for kw in `cat /etc/etc-update.watch | sort` ; do
111
			watch="${watch}s/`echo ${kw} | sed \"s/\//${esc}/g\"`//g ; "
112
		done
113
	fi
114
100
	until [ -f ${TMP}/files/${input} ] || [ ${input} == -1 ] || [ ${input} == -3 ]; do
115
	until [ -f ${TMP}/files/${input} ] || [ ${input} == -1 ] || [ ${input} == -3 ]; do
101
		for file in `ls ${TMP}/files|sort -n`; do
116
		for file in `ls ${TMP}/files|sort -n`; do
117
			local content="`cat ${TMP}/files/${file}`"
118
102
			if (( ${isfirst} == 0 )); then
119
			if (( ${isfirst} == 0 )); then
103
				isfirst=${file}
120
				isfirst=${file}
104
			fi
121
			fi
122
123
			if [ "${watch}" != "" ] ; then
124
				if [ "`echo ${content} | sed \"${watch}\"`" != "`echo ${content}`" ] ; then
125
					skip[i++]=${file}
126
					echo -en "\33[0;37;41m"
127
				fi
128
			fi
129
				
105
			echo -n "${file}${PAR} "
130
			echo -n "${file}${PAR} "
131
			
106
			if (( ${mode} == 0 )); then
132
			if (( ${mode} == 0 )); then
107
				for word in `cat ${TMP}/files/${file}`; do
133
			        local space
108
					echo ${word}
134
			        i=0
135
				for word in ${content}; do
136
                                        if (( i == 0 )); then
137
					    echo -n "${word} <-- "
138
					    space="`echo -n ${word} | sed s/./\ /g`"
139
					elif (( i == 1 )); then
140
					    echo "${word}"
141
					else
142
					    echo "   ${space}     ${word}"
143
					fi
144
					i=${i}+1
109
				done
145
				done
110
			else
146
			else
111
				head -n1 ${TMP}/files/${file}
147
				head -n1 ${TMP}/files/${file}
112
			fi
148
			fi
149
150
			if (( ${i} > 0 )) ; then
151
				echo -en "\33[0;37;39m"
152
			fi
113
		done > ${TMP}/menuitems
153
		done > ${TMP}/menuitems
114
154
115
		if [ "${OVERWRITE_ALL}" == "yes" ]; then
155
		if [ "${OVERWRITE_ALL}" == "yes" ]; then
Lines 125-133 Link Here
125
			if (( ${mode} == 0 )); then
165
			if (( ${mode} == 0 )); then
126
				cat ${TMP}/menuitems
166
				cat ${TMP}/menuitems
127
				echo    "Please select a file to edit by entering the corresponding number."
167
				echo    "Please select a file to edit by entering the corresponding number."
128
				echo    "              (don't use -3 or -5 if you're unsure what to do)"
168
				echo    "          (don't use -3, -5, -7 or -9 if you're unsure what to do)"
129
				echo    "              (-1 to exit) (-3 to auto merge all remaining files)"
169
				echo    "          (-3 to auto merge remaining unwatched files)"
130
				echo -n "                           (-5 to auto-merge AND not use 'mv -i'): "
170
				echo    "          (-5 same as -3 AND not use 'mv -i')"
171
				echo    "          (-7 to auto merge all remaining files)"
172
				echo    "          (-9 same as -7 AND not use 'mv -i')"
173
				echo -n "          (-1 to exit): "
131
				read input
174
				read input
132
			else
175
			else
133
				dialog --title "${title}" --menu "${my_title}" \
176
				dialog --title "${title}" --menu "${my_title}" \
Lines 135-147 Link Here
135
					2> ${TMP}/input
178
					2> ${TMP}/input
136
				input=`cat ${TMP}/input`
179
				input=`cat ${TMP}/input`
137
			fi
180
			fi
181
			if (( ${input} == -9 )); then
182
			    input=-5
183
			    export DONT_MESS="yes"
184
			fi
185
			if (( ${input} == -7 )); then
186
			    input=-3
187
			    export DONT_MESS="yes"
188
			fi
138
			if (( ${input} == -5 )); then
189
			if (( ${input} == -5 )); then
139
				input=-3
190
				input=-3
140
				export mv_opts=""
191
				export mv_opts=""
141
			fi
192
			fi
142
			if (( ${input} == -3 )); then
193
			if (( ${input} == -3 )); then
143
				input=0
194
			        input=0
144
				export OVERWRITE_ALL="yes"
195
			        export OVERWRITE_ALL="yes"
145
			fi
196
			fi
146
		fi # -3 automerge
197
		fi # -3 automerge
147
		if (( ${input} == 0 )); then
198
		if (( ${input} == 0 )); then
Lines 151-160 Link Here
151
}
202
}
152
203
153
function do_file() {
204
function do_file() {
154
	echo
205
	if (( ${noecho} == 0 )) ; then
206
	    echo
207
	fi
155
	local -i my_input
208
	local -i my_input
156
	local -i fcount=0
209
	local -i fcount=0
157
	until (( `cat ${TMP}/files/${input}|wc -l` < 2 )); do
210
	until (( `cat ${TMP}/files/${input}|wc -l` < 2 )); do
211
		local -i i
212
158
		my_input=0
213
		my_input=0
159
		if (( `cat ${TMP}/files/${input}|wc -l` == 2 )); then
214
		if (( `cat ${TMP}/files/${input}|wc -l` == 2 )); then
160
			my_input=1
215
			my_input=1
Lines 209-215 Link Here
209
		file=`cat ${TMP}/files/${input} | sed -e "${fcount}p;d"`
264
		file=`cat ${TMP}/files/${input} | sed -e "${fcount}p;d"`
210
		ofile=`head -n1 ${TMP}/files/${input}`
265
		ofile=`head -n1 ${TMP}/files/${input}`
211
266
212
		do_cfg "${file}" "${ofile}"
267
		for (( i=0; i<${#skip[@]}; i++ )) ; do
268
		    if [ "${skip[${i}]}" == "${input}" ] ; then
269
			break;
270
		    fi
271
		done
272
273
		if (( ${i} >= ${#skip[@]} )) ; then
274
		    noecho=0
275
		    do_cfg "${file}" "${ofile}"
276
		else
277
		    if [ "${OVERWRITE_ALL}" != "yes" ] || [ "${DONT_MESS}" == "yes" ]; then
278
			noecho=0
279
			do_cfg "${file}" "${ofile}"
280
		    else
281
			noecho=1
282
		    fi
283
		fi
213
284
214
		cat ${TMP}/files/${input}|sed -e "${fcount}!p;d" > ${TMP}/files/sed
285
		cat ${TMP}/files/${input}|sed -e "${fcount}!p;d" > ${TMP}/files/sed
215
		mv ${TMP}/files/sed ${TMP}/files/${input}
286
		mv ${TMP}/files/sed ${TMP}/files/${input}
Lines 218-224 Link Here
218
			break
289
			break
219
		fi
290
		fi
220
	done
291
	done
221
	echo
292
	if (( ${noecho} == 0 )) ; then
293
	    echo
294
	fi
222
	rm ${TMP}/files/${input}
295
	rm ${TMP}/files/${input}
223
	count=${count}-1
296
	count=${count}-1
224
}
297
}
Lines 279-284 Link Here
279
			   ;;
352
			   ;;
280
			4) continue
353
			4) continue
281
			   ;;
354
			   ;;
355
		        5) break
356
                           ;;
282
			*) continue
357
			*) continue
283
			   ;;
358
			   ;;
284
		esac
359
		esac
Lines 393-398 Link Here
393
468
394
scan
469
scan
395
470
471
noecho=0
472
396
until (( ${input} == -1 )); do
473
until (( ${input} == -1 )); do
397
	if (( ${count} == 0 )); then
474
	if (( ${count} == 0 )); then
398
		die "Nothing left to do; exiting. :)" 0
475
		die "Nothing left to do; exiting. :)" 0

Return to bug 114713