| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # $NetBSD: install.sub,v 1.58 2020/12/05 18:57:21 tsutsui Exp $ | | 2 | # $NetBSD: install.sub,v 1.59 2020/12/12 05:23:21 tsutsui Exp $ |
3 | # | | 3 | # |
4 | # Copyright (c) 1996 The NetBSD Foundation, Inc. | | 4 | # Copyright (c) 1996 The NetBSD Foundation, Inc. |
5 | # All rights reserved. | | 5 | # All rights reserved. |
6 | # | | 6 | # |
7 | # This code is derived from software contributed to The NetBSD Foundation | | 7 | # This code is derived from software contributed to The NetBSD Foundation |
8 | # by Jason R. Thorpe. | | 8 | # by Jason R. Thorpe. |
9 | # | | 9 | # |
10 | # Redistribution and use in source and binary forms, with or without | | 10 | # Redistribution and use in source and binary forms, with or without |
11 | # modification, are permitted provided that the following conditions | | 11 | # modification, are permitted provided that the following conditions |
12 | # are met: | | 12 | # are met: |
13 | # 1. Redistributions of source code must retain the above copyright | | 13 | # 1. Redistributions of source code must retain the above copyright |
14 | # notice, this list of conditions and the following disclaimer. | | 14 | # notice, this list of conditions and the following disclaimer. |
15 | # 2. Redistributions in binary form must reproduce the above copyright | | 15 | # 2. Redistributions in binary form must reproduce the above copyright |
| @@ -715,71 +715,85 @@ __install_ftp_2 | | | @@ -715,71 +715,85 @@ __install_ftp_2 |
715 | # contents, and use that to determine the files to get. | | 715 | # contents, and use that to determine the files to get. |
716 | cat /tmp/ftp-script.sh > /tmp/ftp-dir.sh | | 716 | cat /tmp/ftp-script.sh > /tmp/ftp-dir.sh |
717 | echo "nlist" >> /tmp/ftp-dir.sh | | 717 | echo "nlist" >> /tmp/ftp-dir.sh |
718 | echo "quit" >> /tmp/ftp-dir.sh | | 718 | echo "quit" >> /tmp/ftp-dir.sh |
719 | echo "__end_commands" >> /tmp/ftp-dir.sh | | 719 | echo "__end_commands" >> /tmp/ftp-dir.sh |
720 | | | 720 | |
721 | if [ $resp = '?' ]; then | | 721 | if [ $resp = '?' ]; then |
722 | sh /tmp/ftp-dir.sh | | 722 | sh /tmp/ftp-dir.sh |
723 | else | | 723 | else |
724 | _sets=$(sh /tmp/ftp-dir.sh | sort -u | sh /tmp/fname_filter.sh) | | 724 | _sets=$(sh /tmp/ftp-dir.sh | sort -u | sh /tmp/fname_filter.sh) |
725 | fi | | 725 | fi |
726 | done | | 726 | done |
727 | rm -f /tmp/ftp-dir.sh /tmp/fname_filter.sh | | 727 | rm -f /tmp/ftp-dir.sh /tmp/fname_filter.sh |
| | | 728 | rm -f /tmp/ftp-script.sh |
| | | 729 | |
| | | 730 | # Prepare ftp-fetch script to fetch binary sets |
| | | 731 | _download_dir=INSTALL |
| | | 732 | _ftp_opts="" |
| | | 733 | _ftp_url="ftp://$_ftp_server_login:$_ftp_server_password@$_ftp_server_ip$_ftp_server_dir/" |
| | | 734 | echo "#!/bin/sh" > /tmp/ftp-fetch.sh |
| | | 735 | echo "cd /mnt" >> /tmp/ftp-fetch.sh |
| | | 736 | echo "mkdir -p $_download_dir" >> /tmp/ftp-fetch.sh |
728 | | | 737 | |
729 | while : ; do | | 738 | while : ; do |
730 | echo "The following sets are available for extraction:" | | 739 | echo "The following sets are available for extraction:" |
731 | echo "(marked sets are already on the extraction list)" | | 740 | echo "(marked sets are already on the extraction list)" |
732 | echo "" | | 741 | echo "" |
733 | | | 742 | |
734 | _next="" | | 743 | _next="" |
735 | for _f in $_sets ; do | | 744 | for _f in $_sets ; do |
736 | if isin $_f $_setsdone; then | | 745 | if isin $_f $_setsdone; then |
737 | echo -n "[X] " | | 746 | echo -n "[X] " |
738 | _next="" | | 747 | _next="" |
739 | else | | 748 | else |
740 | echo -n " " | | 749 | echo -n " " |
741 | if [ -z "$_next" ]; then _next=$_f; fi | | 750 | if [ -z "$_next" ]; then _next=$_f; fi |
742 | fi | | 751 | fi |
743 | echo $_f | | 752 | echo $_f |
744 | done | | 753 | done |
745 | echo "" | | 754 | echo "" |
746 | | | 755 | |
747 | # Get name of the file and add extraction command | | 756 | # Get name of the file and add extraction command |
748 | # to the ftp-script. | | 757 | # to the ftp-fetch script. |
749 | if [ -z "$_next" ]; then resp=n; else resp=y; fi | | 758 | if [ -z "$_next" ]; then resp=n; else resp=y; fi |
750 | echo -n "Continue to add filenames [$resp]? " | | 759 | echo -n "Continue to add filenames [$resp]? " |
751 | getresp "$resp" | | 760 | getresp "$resp" |
752 | if [ "$resp" = "n" ]; then | | 761 | if [ "$resp" = "n" ]; then |
753 | break | | 762 | break |
754 | fi | | 763 | fi |
755 | | | 764 | |
756 | echo -n "File name [$_next]? " | | 765 | echo -n "File name [$_next]? " |
757 | getresp "$_next" | | 766 | getresp "$_next" |
758 | if isin $resp $_sets; then | | 767 | if isin $resp $_sets; then |
759 | echo "get $resp |\"pax -zr${verbose_flag}pe\"" >> \ | | 768 | echo "echo Fetching $resp:" >> \ |
760 | /tmp/ftp-script.sh | | 769 | /tmp/ftp-fetch.sh |
| | | 770 | echo "ftp ${_ftp_opts} -o $_download_dir/$resp ${_ftp_url}$resp" >> \ |
| | | 771 | /tmp/ftp-fetch.sh |
| | | 772 | echo "echo Extracting $resp:" >> \ |
| | | 773 | /tmp/ftp-fetch.sh |
| | | 774 | echo "pax -zr${verbose_flag}pe -f $_download_dir/$resp" >> \ |
| | | 775 | /tmp/ftp-fetch.sh |
| | | 776 | echo "rm -f $_download_dir/$resp" >> \ |
| | | 777 | /tmp/ftp-fetch.sh |
761 | _setsdone="$resp $_setsdone" | | 778 | _setsdone="$resp $_setsdone" |
762 | else | | 779 | else |
763 | echo "You entered an invalid filename." | | 780 | echo "You entered an invalid filename." |
764 | echo "" | | 781 | echo "" |
765 | fi | | 782 | fi |
766 | done | | 783 | done |
767 | | | 784 | |
768 | echo "quit" >> /tmp/ftp-script.sh | | 785 | sh /tmp/ftp-fetch.sh |
769 | echo "__end_commands" >> /tmp/ftp-script.sh | | 786 | rm -f /tmp/ftp-fetch.sh |
770 | | | | |
771 | sh /tmp/ftp-script.sh | | | |
772 | rm -f /tmp/ftp-script.sh | | | |
773 | echo "Extraction complete." | | 787 | echo "Extraction complete." |
774 | } | | 788 | } |
775 | | | 789 | |
776 | install_from_mounted_fs() { | | 790 | install_from_mounted_fs() { |
777 | # $1 - directory containing installation sets | | 791 | # $1 - directory containing installation sets |
778 | local _filename | | 792 | local _filename |
779 | local _sets | | 793 | local _sets |
780 | local _next | | 794 | local _next |
781 | local _all | | 795 | local _all |
782 | local _f | | 796 | local _f |
783 | local _dirname | | 797 | local _dirname |
784 | | | 798 | |
785 | _dirname=$1 | | 799 | _dirname=$1 |