OSDN Git Service

Fixed a bug that incompletion of necessary build dependent detection caused incomlete...
[portsreinstall/current.git] / bin / portsreinstall
1 #!/bin/sh -e
2 # ==================================================================================
3 # portsreinstall main script
4 # Copyright (C) 2010-2018 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
5 # This software is distributed under the 2-Clause BSD License.
6 # ==================================================================================
7
8 # ==================================================
9 # ================== ENVIRONMENT ===================
10 # ==================================================
11
12 # ============ Set up of environment =============
13 PROGRAM=portsreinstall
14 APPNAME=`basename "$0"`
15
16 MYPREFIX=`realpath "\`dirname \"$0\"\`"/..`
17 LIBDIR=${MYPREFIX}/lib/${PROGRAM}
18 LIBEXECDIR=${MYPREFIX}/libexec/${PROGRAM}
19 SHAREDIR=${MYPREFIX}/share/${PROGRAM}
20 ETCDIR=${MYPREFIX}/etc
21
22 . ${LIBDIR}/libcommand.sh
23 . ${LIBDIR}/libcommand_do.sh
24 . ${LIBDIR}/libcommand_flexconf.sh
25 . ${LIBDIR}/libcommand_forget.sh
26 . ${LIBDIR}/libcommand_pkgs.sh
27 . ${LIBDIR}/libcommand_show.sh
28 . ${LIBDIR}/libconf.sh
29 . ${LIBDIR}/libdatabase_build.sh
30 . ${LIBDIR}/libdatabase_maintain.sh
31 . ${LIBDIR}/libdatabase_query.sh
32 . ${LIBDIR}/libdatabase_record.sh
33 . ${LIBDIR}/libdeinstall.sh
34 . ${LIBDIR}/libfileedit.sh
35 . ${LIBDIR}/libfs.sh
36 . ${LIBDIR}/libmain.sh
37 . ${LIBDIR}/libmessage.sh
38 . ${LIBDIR}/libmisc.sh
39 . ${LIBDIR}/liboptions.sh
40 . ${LIBDIR}/libpkgsys.sh
41 . ${LIBDIR}/libprogram.sh
42 . ${LIBDIR}/libreinstall.sh
43 . ${LIBDIR}/libstr.sh
44 . ${LIBDIR}/libtemp.sh
45 . ${LIBDIR}/libusage.sh
46
47 . ${LIBDIR}/main/libcommand.sh
48 . ${LIBDIR}/main/libmain.sh
49 . ${LIBDIR}/main/liboptions.sh
50 . ${LIBDIR}/main/libtemp.sh
51 . ${LIBDIR}/main/libusage.sh
52
53 DBDIR=/var/tmp/${APPNAME}.db
54 CONFFILE=${ETCDIR}/${PROGRAM}.conf
55 PKGTOOLSCONF=${ETCDIR}/pkgtools.conf
56
57 main_set_version
58 misc_init_vardefs
59 temp_trap_init
60 database_maintain_reset_execflag
61
62 # ==================================================
63 # ========= PARSING OPTIONS AND ARGUMENTS ==========
64 # ==================================================
65
66 main_parse_options_arguments "$@"
67 shift "${OPTIONS_SHIFT}"
68 shift "${COMMAND_SHIFT}"
69
70 # ========================================================
71 # ================== SET UP OF PARAMETERS ==================
72 # ========================================================
73
74 main_setup_parameters "$@"
75
76 # =================================================================================
77 # ================== OPERATION WITHOUT PACKAGES MANAGEMENT TOOLS ==================
78 # =================================================================================
79
80 main_operation_without_pkg_management_tools "$@"
81
82 # ===================================================
83 # ================== SET UP OF TOOLS ==================
84 # ===================================================
85
86 # ============= Upgrade of tools =============
87
88 # Get the flavored port origin for this utility if installed by port
89 MYPORTORIGIN=`pkgsys_get_my_origin 2> /dev/null` || :
90
91 # Collect all installed packages
92 main_collect_all_installed_packages
93
94 # Preliminary inspection of tools which have to be up-to-date
95 main_determine_all_target_ports_of_tools
96 main_preliminary_inspection_of_initial_tools
97 main_preliminary_inspection_of_tools
98
99 # Upgrade of pkg(8) if new
100 main_upgrade_pkg8_if_new
101
102 # Upgrade of dialog4ports(1) if new
103 main_upgrade_dialog4ports1_if_new
104
105 # Upgrade of this utility if new
106 main_self_upgrade
107
108
109 # ==================================================
110 # ================== PREPARATION ===================
111 # ==================================================
112
113 # ============= Correspondence to configuration changes =============
114
115 # Overlay onto the temporary database by reflecting changes in configuration
116 main_reflect_conf_changes
117
118 # ============= Database construction =============
119
120 # Execute command operations of database construction
121 command_all_exec_build_database "$@"
122
123 # ==================================================
124 # ====================== MAIN ======================
125 # ==================================================
126
127 # Execute command operations which must be done before the main process
128 command_all_exec_before_main "$@"
129
130 # Execute command operations as the main process
131 command_all_exec_main "$@"