Deleted Added
full compact
freebsd-update.sh (177527) freebsd-update.sh (177601)
1#!/bin/sh
2
3#-
4# Copyright 2004-2007 Colin Percival
5# All rights reserved
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted providing that the following conditions

--- 11 unchanged lines hidden (view full) ---

20# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
25# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26# POSSIBILITY OF SUCH DAMAGE.
27
1#!/bin/sh
2
3#-
4# Copyright 2004-2007 Colin Percival
5# All rights reserved
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted providing that the following conditions

--- 11 unchanged lines hidden (view full) ---

20# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
25# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26# POSSIBILITY OF SUCH DAMAGE.
27
28# $FreeBSD: head/usr.sbin/freebsd-update/freebsd-update.sh 177527 2008-03-23 13:41:54Z cperciva $
28# $FreeBSD: head/usr.sbin/freebsd-update/freebsd-update.sh 177601 2008-03-25 11:31:16Z cperciva $
29
30#### Usage function -- called from command-line handling code.
31
32# Usage instructions. Options not listed:
33# --debug -- don't filter output from utilities
34# --no-stats -- don't show progress statistics while fetching files
35usage () {
36 cat <<EOF

--- 2469 unchanged lines hidden (view full) ---

2506 exit 0
2507 fi
2508 fi
2509
2510 # If we haven't already dealt with the world, deal with it.
2511 if ! [ -f $1/worlddone ]; then
2512 # Install new shared libraries next
2513 grep -vE '^/boot/' $1/INDEX-NEW |
29
30#### Usage function -- called from command-line handling code.
31
32# Usage instructions. Options not listed:
33# --debug -- don't filter output from utilities
34# --no-stats -- don't show progress statistics while fetching files
35usage () {
36 cat <<EOF

--- 2469 unchanged lines hidden (view full) ---

2506 exit 0
2507 fi
2508 fi
2509
2510 # If we haven't already dealt with the world, deal with it.
2511 if ! [ -f $1/worlddone ]; then
2512 # Install new shared libraries next
2513 grep -vE '^/boot/' $1/INDEX-NEW |
2514 grep -E '/lib/.*\.so\.[0-9]+' > INDEX-NEW
2514 grep -E '/lib/.*\.so\.[0-9]+\|' > INDEX-NEW
2515 install_from_index INDEX-NEW || return 1
2516
2517 # Deal with everything else
2518 grep -vE '^/boot/' $1/INDEX-OLD |
2515 install_from_index INDEX-NEW || return 1
2516
2517 # Deal with everything else
2518 grep -vE '^/boot/' $1/INDEX-OLD |
2519 grep -vE '/lib/.*\.so\.[0-9]+' > INDEX-OLD
2519 grep -vE '/lib/.*\.so\.[0-9]+\|' > INDEX-OLD
2520 grep -vE '^/boot/' $1/INDEX-NEW |
2520 grep -vE '^/boot/' $1/INDEX-NEW |
2521 grep -vE '/lib/.*\.so\.[0-9]+' > INDEX-NEW
2521 grep -vE '/lib/.*\.so\.[0-9]+\|' > INDEX-NEW
2522 install_from_index INDEX-NEW || return 1
2523 install_delete INDEX-OLD INDEX-NEW || return 1
2524
2525 # Rebuild /etc/spwd.db and /etc/pwd.db if necessary.
2526 if [ /etc/master.passwd -nt /etc/spwd.db ] ||
2527 [ /etc/master.passwd -nt /etc/pwd.db ]; then
2528 pwd_mkdb /etc/master.passwd
2529 fi

--- 4 unchanged lines hidden (view full) ---

2534 fi
2535
2536 # We've finished installing the world and deleting old files
2537 # which are not shared libraries.
2538 touch $1/worlddone
2539
2540 # Do we need to ask the user to portupgrade now?
2541 grep -vE '^/boot/' $1/INDEX-NEW |
2522 install_from_index INDEX-NEW || return 1
2523 install_delete INDEX-OLD INDEX-NEW || return 1
2524
2525 # Rebuild /etc/spwd.db and /etc/pwd.db if necessary.
2526 if [ /etc/master.passwd -nt /etc/spwd.db ] ||
2527 [ /etc/master.passwd -nt /etc/pwd.db ]; then
2528 pwd_mkdb /etc/master.passwd
2529 fi

--- 4 unchanged lines hidden (view full) ---

2534 fi
2535
2536 # We've finished installing the world and deleting old files
2537 # which are not shared libraries.
2538 touch $1/worlddone
2539
2540 # Do we need to ask the user to portupgrade now?
2541 grep -vE '^/boot/' $1/INDEX-NEW |
2542 grep -E '/lib/.*\.so\.[0-9]+' |
2542 grep -E '/lib/.*\.so\.[0-9]+\|' |
2543 cut -f 1 -d '|' |
2544 sort > newfiles
2545 if grep -vE '^/boot/' $1/INDEX-OLD |
2543 cut -f 1 -d '|' |
2544 sort > newfiles
2545 if grep -vE '^/boot/' $1/INDEX-OLD |
2546 grep -E '/lib/.*\.so\.[0-9]+' |
2546 grep -E '/lib/.*\.so\.[0-9]+\|' |
2547 cut -f 1 -d '|' |
2548 sort |
2549 join -v 1 - newfiles |
2550 grep -q .; then
2551 cat <<-EOF
2552
2553Completing this upgrade requires removing old shared object files.
2554Please rebuild all installed 3rd party software (e.g., programs
2555installed from the ports tree) and then run "$0 install"
2556again to finish installing updates.
2557 EOF
2558 rm newfiles
2559 exit 0
2560 fi
2561 rm newfiles
2562 fi
2563
2564 # Remove old shared libraries
2565 grep -vE '^/boot/' $1/INDEX-NEW |
2547 cut -f 1 -d '|' |
2548 sort |
2549 join -v 1 - newfiles |
2550 grep -q .; then
2551 cat <<-EOF
2552
2553Completing this upgrade requires removing old shared object files.
2554Please rebuild all installed 3rd party software (e.g., programs
2555installed from the ports tree) and then run "$0 install"
2556again to finish installing updates.
2557 EOF
2558 rm newfiles
2559 exit 0
2560 fi
2561 rm newfiles
2562 fi
2563
2564 # Remove old shared libraries
2565 grep -vE '^/boot/' $1/INDEX-NEW |
2566 grep -E '/lib/.*\.so\.[0-9]+' > INDEX-NEW
2566 grep -E '/lib/.*\.so\.[0-9]+\|' > INDEX-NEW
2567 grep -vE '^/boot/' $1/INDEX-OLD |
2567 grep -vE '^/boot/' $1/INDEX-OLD |
2568 grep -E '/lib/.*\.so\.[0-9]+' > INDEX-OLD
2568 grep -E '/lib/.*\.so\.[0-9]+\|' > INDEX-OLD
2569 install_delete INDEX-OLD INDEX-NEW || return 1
2570
2571 # Remove temporary files
2572 rm INDEX-OLD INDEX-NEW
2573}
2574
2575# Rearrange bits to allow the installed updates to be rolled back
2576install_setup_rollback () {

--- 49 unchanged lines hidden (view full) ---

2626 fi
2627}
2628
2629# Install old files, delete new files, and update linker.hints
2630rollback_files () {
2631 # Install old shared library files which don't have the same path as
2632 # a new shared library file.
2633 grep -vE '^/boot/' $1/INDEX-NEW |
2569 install_delete INDEX-OLD INDEX-NEW || return 1
2570
2571 # Remove temporary files
2572 rm INDEX-OLD INDEX-NEW
2573}
2574
2575# Rearrange bits to allow the installed updates to be rolled back
2576install_setup_rollback () {

--- 49 unchanged lines hidden (view full) ---

2626 fi
2627}
2628
2629# Install old files, delete new files, and update linker.hints
2630rollback_files () {
2631 # Install old shared library files which don't have the same path as
2632 # a new shared library file.
2633 grep -vE '^/boot/' $1/INDEX-NEW |
2634 grep -E '/lib/.*\.so\.[0-9]+' |
2634 grep -E '/lib/.*\.so\.[0-9]+\|' |
2635 cut -f 1 -d '|' |
2636 sort > INDEX-NEW.libs.flist
2637 grep -vE '^/boot/' $1/INDEX-OLD |
2635 cut -f 1 -d '|' |
2636 sort > INDEX-NEW.libs.flist
2637 grep -vE '^/boot/' $1/INDEX-OLD |
2638 grep -E '/lib/.*\.so\.[0-9]+' |
2638 grep -E '/lib/.*\.so\.[0-9]+\|' |
2639 sort -k 1,1 -t '|' - |
2640 join -t '|' -v 1 - INDEX-NEW.libs.flist > INDEX-OLD
2641 install_from_index INDEX-OLD || return 1
2642
2643 # Deal with files which are neither kernel nor shared library
2644 grep -vE '^/boot/' $1/INDEX-OLD |
2639 sort -k 1,1 -t '|' - |
2640 join -t '|' -v 1 - INDEX-NEW.libs.flist > INDEX-OLD
2641 install_from_index INDEX-OLD || return 1
2642
2643 # Deal with files which are neither kernel nor shared library
2644 grep -vE '^/boot/' $1/INDEX-OLD |
2645 grep -vE '/lib/.*\.so\.[0-9]+' > INDEX-OLD
2645 grep -vE '/lib/.*\.so\.[0-9]+\|' > INDEX-OLD
2646 grep -vE '^/boot/' $1/INDEX-NEW |
2646 grep -vE '^/boot/' $1/INDEX-NEW |
2647 grep -vE '/lib/.*\.so\.[0-9]+' > INDEX-NEW
2647 grep -vE '/lib/.*\.so\.[0-9]+\|' > INDEX-NEW
2648 install_from_index INDEX-OLD || return 1
2649 install_delete INDEX-NEW INDEX-OLD || return 1
2650
2651 # Install any old shared library files which we didn't install above.
2652 grep -vE '^/boot/' $1/INDEX-OLD |
2648 install_from_index INDEX-OLD || return 1
2649 install_delete INDEX-NEW INDEX-OLD || return 1
2650
2651 # Install any old shared library files which we didn't install above.
2652 grep -vE '^/boot/' $1/INDEX-OLD |
2653 grep -E '/lib/.*\.so\.[0-9]+' |
2653 grep -E '/lib/.*\.so\.[0-9]+\|' |
2654 sort -k 1,1 -t '|' - |
2655 join -t '|' - INDEX-NEW.libs.flist > INDEX-OLD
2656 install_from_index INDEX-OLD || return 1
2657
2658 # Delete unneeded shared library files
2659 grep -vE '^/boot/' $1/INDEX-OLD |
2654 sort -k 1,1 -t '|' - |
2655 join -t '|' - INDEX-NEW.libs.flist > INDEX-OLD
2656 install_from_index INDEX-OLD || return 1
2657
2658 # Delete unneeded shared library files
2659 grep -vE '^/boot/' $1/INDEX-OLD |
2660 grep -E '/lib/.*\.so\.[0-9]+' > INDEX-OLD
2660 grep -E '/lib/.*\.so\.[0-9]+\|' > INDEX-OLD
2661 grep -vE '^/boot/' $1/INDEX-NEW |
2661 grep -vE '^/boot/' $1/INDEX-NEW |
2662 grep -E '/lib/.*\.so\.[0-9]+' > INDEX-NEW
2662 grep -E '/lib/.*\.so\.[0-9]+\|' > INDEX-NEW
2663 install_delete INDEX-NEW INDEX-OLD || return 1
2664
2665 # Deal with kernel files
2666 grep -E '^/boot/' $1/INDEX-OLD > INDEX-OLD
2667 grep -E '^/boot/' $1/INDEX-NEW > INDEX-NEW
2668 install_from_index INDEX-OLD || return 1
2669 install_delete INDEX-NEW INDEX-OLD || return 1
2670 if [ -s INDEX-OLD -o -s INDEX-NEW ]; then

--- 109 unchanged lines hidden ---
2663 install_delete INDEX-NEW INDEX-OLD || return 1
2664
2665 # Deal with kernel files
2666 grep -E '^/boot/' $1/INDEX-OLD > INDEX-OLD
2667 grep -E '^/boot/' $1/INDEX-NEW > INDEX-NEW
2668 install_from_index INDEX-OLD || return 1
2669 install_delete INDEX-NEW INDEX-OLD || return 1
2670 if [ -s INDEX-OLD -o -s INDEX-NEW ]; then

--- 109 unchanged lines hidden ---