OSDN Git Service

Fixed the wrong implementation of show errormessage.
[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/liboptions.sh
49 . ${LIBDIR}/main/libtemp.sh
50 . ${LIBDIR}/main/libusage.sh
51
52 DBDIR=/var/tmp/${APPNAME}.db
53 CONFFILE=${ETCDIR}/${PROGRAM}.conf
54 PKGTOOLSCONF=${ETCDIR}/pkgtools.conf
55
56 main_set_version
57 misc_init_vardefs
58 temp_trap_init
59 database_maintain_reset_execflag
60
61 # ==================================================
62 # ========= PARSING OPTIONS AND ARGUMENTS ==========
63 # ==================================================
64
65 main_parse_options_arguments "$@"
66
67 # ========================================================
68 # ================== SET UP OF PARAMETERS ==================
69 # ========================================================
70
71 main_setup_parameters "$@"
72
73 # =================================================================================
74 # ================== OPERATION WITHOUT PACKAGES MANAGEMENT TOOLS ==================
75 # =================================================================================
76
77 main_operation_without_pkg_management_tools "$@"
78
79 # ===================================================
80 # ================== SET UP OF TOOLS ==================
81 # ===================================================
82
83 # ============= Upgrade of tools =============
84
85 # Get the flavored port origin for this utility if installed by port
86 MYPORTORIGIN=`pkgsys_get_my_origin 2> /dev/null` || :
87
88 # Collect all installed packages
89 main_collect_all_installed_packages
90
91 # Preliminary inspection of tools which have to be up-to-date
92 main_preliminary_inspection_of_tools
93
94 # Upgrade of pkg(8) if new
95 main_upgrade_pkg8_if_new
96
97 # Upgrade of dialog4ports(1) if new
98 main_upgrade_dialog4ports1_if_new
99
100 # Upgrade of this utility if new
101 main_self_upgrade
102
103
104 # ==================================================
105 # ================== PREPARATION ===================
106 # ==================================================
107
108 # ============= Correspondence to configuration changes =============
109
110 # Overlay onto the temporary database by reflecting changes in configuration
111 main_reflect_conf_changes
112
113 # ============= Database construction =============
114
115 # Execute command operations which must be done before the database construction
116 command_all_exec_before_build_database "$@"
117
118 # Execute command operations of database construction
119 command_all_exec_build_database "$@"
120
121 # ==================================================
122 # ====================== MAIN ======================
123 # ==================================================
124
125 # Execute command operations which must be done before the main process
126 command_all_exec_before_main "$@"
127
128 # Execute command operations as the main process
129 command_all_exec_main "$@"