1 # rpmvercmp.at: rpm config link behavior tests
3 AT_BANNER([RPM config symlink behavior])
5 # Install over existing config file
6 AT_SETUP([install config on existiting symlink])
11 cf="${RPMTEST}"/etc/my.conf
12 rm -rf "${cf}" "${cf}".rpm*
15 runroot rpmbuild --quiet -bb \
17 --define "filedata foo" \
18 --define "filetype link" \
19 /data/SPECS/configtest.spec
21 ln -s "otherstuff" "${cf}"
22 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
24 runroot rpm -e configtest
25 readlink "${cf}.rpmorig"
31 [warning: /etc/my.conf saved as /etc/my.conf.rpmorig]
35 # Install over existing identical config link, no backup needed
36 AT_SETUP([install config on existiting identical link])
37 AT_KEYWORDS([install])
41 cf="${RPMTEST}"/etc/my.conf
42 rm -rf "${cf}" "${cf}".rpm*
45 runroot rpmbuild --quiet -bb \
47 --define "filedata foo" \
48 --define "filetype link" \
49 /data/SPECS/configtest.spec
53 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
55 runroot rpm -e configtest
65 # Erase unmodified config link, no backup here
66 AT_SETUP([erase unchanged config link])
67 AT_KEYWORDS([install])
71 cf="${RPMTEST}"/etc/my.conf
72 rm -rf "${cf}" "${cf}".rpm*
75 runroot rpmbuild --quiet -bb \
77 --define "filedata foo" \
78 --define "filetype link" \
79 /data/SPECS/configtest.spec
81 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
83 runroot rpm -e configtest
92 # Erase modified config link
93 AT_SETUP([erase changed config link])
94 AT_KEYWORDS([install])
98 cf="${RPMTEST}"/etc/my.conf
99 rm -rf "${cf}" "${cf}".rpm*
102 runroot rpmbuild --quiet -bb \
104 --define "filedata foo" \
105 --define "filetype link" \
106 /data/SPECS/configtest.spec
108 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
110 ln -sf "otherstuff" "${cf}"
111 runroot rpm -e configtest
112 readlink "${cf}.rpmsave"
118 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
122 # ------------------------------
123 # (Build and) upgrade package with config link, no backup here
124 AT_SETUP([upgrade unchanged config link])
125 AT_KEYWORDS([install])
129 cf="${RPMTEST}"/etc/my.conf
130 rm -rf "${cf}" "${cf}".rpm*
133 for v in "1.0" "2.0"; do
134 runroot rpmbuild --quiet -bb \
136 --define "filedata foo" \
137 --define "filetype link" \
138 /data/SPECS/configtest.spec
141 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
143 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
154 # ------------------------------
155 # Upgrade package with modified config link, unchanged in pkg. No backup.
156 AT_SETUP([upgrade modified config link])
157 AT_KEYWORDS([install])
161 cf="${RPMTEST}"/etc/my.conf
162 rm -rf "${cf}" "${cf}".rpm*
165 for v in "1.0" "2.0"; do
166 runroot rpmbuild --quiet -bb \
168 --define "filedata foo" \
169 --define "filetype link" \
170 /data/SPECS/configtest.spec
173 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
175 ln -sf "otherstuff" "${cf}"
177 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
188 # ------------------------------
189 # Upgrade package with unmodified config link, changed in pkg
190 AT_SETUP([upgrade changing config link])
191 AT_KEYWORDS([install])
195 cf="${RPMTEST}"/etc/my.conf
196 rm -rf "${cf}" "${cf}".rpm*
199 for v in "1.0" "2.0"; do
200 runroot rpmbuild --quiet -bb \
202 --define "filedata foo-$v" \
203 --define "filetype link" \
204 /data/SPECS/configtest.spec
207 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
209 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
219 # ------------------------------
220 # Upgrade package with locally modified config link, changed in pkg
221 AT_SETUP([upgrade changing, modified config link 1])
222 AT_KEYWORDS([install])
226 cf="${RPMTEST}"/etc/my.conf
227 rm -rf "${cf}" "${cf}".rpm*
230 for v in "1.0" "2.0"; do
231 runroot rpmbuild --quiet -bb \
233 --define "filedata foo-$v" \
234 --define "filetype link" \
235 /data/SPECS/configtest.spec
238 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
240 ln -sf "otherstuff" "${cf}"
242 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
244 readlink "${cf}.rpmsave"
252 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
256 # ------------------------------
257 # Modified config link matches the content from new package.
258 AT_SETUP([upgrade changing, modified config link 2])
259 AT_KEYWORDS([install])
263 cf="${RPMTEST}"/etc/my.conf
264 rm -rf "${cf}" "${cf}".rpm*
267 for v in "1.0" "2.0"; do
268 runroot rpmbuild --quiet -bb \
270 --define "filedata foo-$v" \
271 --define "filetype link" \
272 /data/SPECS/configtest.spec
275 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
277 ln -sf "foo-2.0" "${cf}"
279 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
290 # config(noreplace) variants of the same cases.
292 # ------------------------------
293 # (Build and) upgrade package with config file, no backup here
294 AT_SETUP([upgrade unchanged config(noreplace) link])
295 AT_KEYWORDS([install])
299 cf="${RPMTEST}"/etc/my.conf
300 rm -rf "${cf}" "${cf}".rpm*
303 for v in "1.0" "2.0"; do
304 runroot rpmbuild --quiet -bb \
306 --define "filedata foo" \
307 --define "filetype link" \
308 --define "noreplace 1" \
309 /data/SPECS/configtest.spec
312 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
314 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
325 # ------------------------------
326 # Upgrade package with locally modified config file, unchanged in pkg
327 AT_SETUP([upgrade modified config(noreplace) link])
328 AT_KEYWORDS([install])
332 cf="${RPMTEST}"/etc/my.conf
333 rm -rf "${cf}" "${cf}".rpm*
336 for v in "1.0" "2.0"; do
337 runroot rpmbuild --quiet -bb \
339 --define "filedata foo" \
340 --define "filetype link" \
341 --define "noreplace 1" \
342 /data/SPECS/configtest.spec
345 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
347 ln -sf "otherstuff" "${cf}"
349 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
360 # ------------------------------
361 # Upgrade package with unmodified config file, changed in pkg
362 AT_SETUP([upgrade changing config(noreplace) link])
363 AT_KEYWORDS([install])
367 cf="${RPMTEST}"/etc/my.conf
368 rm -rf "${cf}" "${cf}".rpm*
371 for v in "1.0" "2.0"; do
372 runroot rpmbuild --quiet -bb \
374 --define "filedata foo-$v" \
375 --define "filetype link" \
376 --define "noreplace 1" \
377 /data/SPECS/configtest.spec
380 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
382 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
392 # ------------------------------
393 # Upgrade package with locally modified config file, changed in pkg
394 AT_SETUP([upgrade changing, modified config(noreplace) link 1])
395 AT_KEYWORDS([install])
399 cf="${RPMTEST}"/etc/my.conf
400 rm -rf "${cf}" "${cf}".rpm*
403 for v in "1.0" "2.0"; do
404 runroot rpmbuild --quiet -bb \
406 --define "filedata foo-$v" \
407 --define "filetype link" \
408 --define "noreplace 1" \
409 /data/SPECS/configtest.spec
412 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
414 ln -sf "otherstuff" "${cf}"
416 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
418 readlink "${cf}.rpmnew"
426 [warning: /etc/my.conf created as /etc/my.conf.rpmnew]
430 # ------------------------------
431 # Modified config link matches the content from new package.
432 AT_SETUP([upgrade changing, modified config(noreplace) link 2])
433 AT_KEYWORDS([install])
437 cf="${RPMTEST}"/etc/my.conf
438 rm -rf "${cf}" "${cf}".rpm*
441 for v in "1.0" "2.0"; do
442 runroot rpmbuild --quiet -bb \
444 --define "filedata foo-$v" \
445 --define "filetype link" \
446 --define "noreplace 1" \
447 /data/SPECS/configtest.spec
450 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
452 ln -sf "foo-2.0" "${cf}"
454 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
456 test ! -L "${cf}.rpmnew"
466 # Shared config link variants of the same cases
467 # ------------------------------
468 # (Build and) upgrade package with config file, no backup here
469 AT_SETUP([upgrade unchanged shared config link])
470 AT_KEYWORDS([install])
474 cf="${RPMTEST}"/etc/my.conf
475 rm -rf "${cf}" "${cf}".rpm*
479 for v in "1.0" "2.0"; do
480 runroot rpmbuild --quiet -bb \
483 --define "filedata foo" \
484 --define "filetype link" \
485 /data/SPECS/configtest.spec
490 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
491 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
494 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
495 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
506 # ------------------------------
507 # Upgrade package with locally modified config file, unchanged in pkg
508 AT_SETUP([upgrade modified shared config link])
509 AT_KEYWORDS([install])
513 cf="${RPMTEST}"/etc/my.conf
514 rm -rf "${cf}" "${cf}".rpm*
518 for v in "1.0" "2.0"; do
519 runroot rpmbuild --quiet -bb \
522 --define "filedata foo" \
523 --define "filetype link" \
524 /data/SPECS/configtest.spec
529 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
530 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
532 ln -sf "otherstuff" "${cf}"
535 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
536 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
547 # ------------------------------
548 # Upgrade package with unmodified config file, changed in pkg
549 AT_SETUP([upgrade changing shared config link])
550 AT_KEYWORDS([install])
554 cf="${RPMTEST}"/etc/my.conf
555 rm -rf "${cf}" "${cf}".rpm*
559 for v in "1.0" "2.0"; do
560 runroot rpmbuild --quiet -bb \
563 --define "filedata foo-$v" \
564 --define "filetype link" \
565 /data/SPECS/configtest.spec
570 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
571 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
574 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
575 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
585 # ------------------------------
586 # Upgrade package with locally modified config file, changed in pkg
587 AT_SETUP([upgrade changing, modified shared config link 1])
588 AT_KEYWORDS([install])
592 cf="${RPMTEST}"/etc/my.conf
593 rm -rf "${cf}" "${cf}".rpm*
597 for v in "1.0" "2.0"; do
598 runroot rpmbuild --quiet -bb \
601 --define "filedata foo-$v" \
602 --define "filetype link" \
603 /data/SPECS/configtest.spec
608 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
609 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
611 ln -sf "otherstuff" "${cf}"
614 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
615 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
617 readlink "${cf}.rpmsave"
625 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
629 # ------------------------------
630 # Modified config link matches the content from new package.
631 AT_SETUP([upgrade changing, modified shared config link 2])
632 AT_KEYWORDS([install])
636 cf="${RPMTEST}"/etc/my.conf
637 rm -rf "${cf}" "${cf}".rpm*
641 for v in "1.0" "2.0"; do
642 runroot rpmbuild --quiet -bb \
645 --define "filedata foo-$v" \
646 --define "filetype link" \
647 /data/SPECS/configtest.spec
652 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
653 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
655 ln -sf "foo-2.0" "${cf}"
658 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
659 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
670 # Shared config(noreplace) variants of the more interesting cases
671 # ------------------------------
672 # Upgrade package with locally modified config file, changed in pkg.
673 AT_SETUP([upgrade changing, modified shared config(noreplace) link 1])
674 AT_KEYWORDS([install])
678 cf="${RPMTEST}"/etc/my.conf
679 rm -rf "${cf}" "${cf}".rpm*
683 for v in "1.0" "2.0"; do
684 runroot rpmbuild --quiet -bb \
687 --define "filedata foo-$v" \
688 --define "filetype link" \
689 --define "noreplace 1" \
690 /data/SPECS/configtest.spec
695 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
696 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
698 ln -sf "otherstuff" "${cf}"
701 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
702 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
704 readlink "${cf}.rpmnew"
712 [warning: /etc/my.conf created as /etc/my.conf.rpmnew]
716 # ------------------------------
717 # Modified config link matches the content from new package.
718 AT_SETUP([upgrade changing, modified shared config(noreplace) link 2])
719 AT_KEYWORDS([install])
723 cf="${RPMTEST}"/etc/my.conf
724 rm -rf "${cf}" "${cf}".rpm*
728 for v in "1.0" "2.0"; do
729 runroot rpmbuild --quiet -bb \
732 --define "filedata foo-$v" \
733 --define "filetype link" \
734 --define "noreplace 1" \
735 /data/SPECS/configtest.spec
740 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
741 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
743 ln -sf "foo-2.0" "${cf}"
746 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
747 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
749 test ! -L "${cf}.rpmnew"