OSDN Git Service

Fixed bugs about command_do_update_host_files().
[portsreinstall/current.git] / share / bin / portsreinstall-chroot-mount
1 #!/bin/sh -e
2 # ==================================================================================
3 # portsreinstall chroot main script
4 # Copyright (C) 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}/chroot/libfs.sh
48
49 . ${LIBDIR}/chroot-mount/libcommand.sh
50 . ${LIBDIR}/chroot-mount/libconf.sh
51 . ${LIBDIR}/chroot-mount/libdatabase_maintain.sh
52 . ${LIBDIR}/chroot-mount/libmain.sh
53 . ${LIBDIR}/chroot-mount/libmessage.sh
54 . ${LIBDIR}/chroot-mount/liboptions.sh
55 . ${LIBDIR}/chroot-mount/libtemp.sh
56 . ${LIBDIR}/chroot-mount/libusage.sh
57
58 [ -n "${SYSTEMBASE}" ] || SYSTEMBASE=`realpath "${MYPREFIX}"/../..`
59 DBDIR=${SYSTEMBASE}/var/tmp/${PROGRAM}-chroot.db
60
61 main_set_version
62 misc_init_vardefs
63 temp_trap_init
64 main_load_conf
65 database_maintain_reset_execflag
66 fs_save_current_systembase "${SYSTEMBASE}"
67
68 # ==================================================
69 # ========= PARSING OPTIONS AND ARGUMENTS ==========
70 # ==================================================
71
72 main_parse_options_arguments "$@"
73 shift "${OPTIONS_SHIFT}"
74 shift "${COMMAND_SHIFT}"
75 opt_invalidate_mount_privilege=no
76
77 # ========================================================
78 # ================== SET UP OF PARAMETERS ==================
79 # ========================================================
80
81 # Termination messages during construction of the temporary database
82 temp_setup_terminate_process
83
84 # Opening title
85 message_credit
86 message_echo
87
88 # Check of the mounting/unmounting privilege of the environment
89 main_check_of_mounting_unmounting_privilege
90
91 # ==================================================
92 # ====================== MAIN =======================
93 # ==================================================
94
95 command_all_exec_without_pkgtools "$@"