CN117632223A - Configuration file synchronization methods and related equipment - Google Patents
Configuration file synchronization methods and related equipment Download PDFInfo
- Publication number
- CN117632223A CN117632223A CN202210979610.5A CN202210979610A CN117632223A CN 117632223 A CN117632223 A CN 117632223A CN 202210979610 A CN202210979610 A CN 202210979610A CN 117632223 A CN117632223 A CN 117632223A
- Authority
- CN
- China
- Prior art keywords
- configuration file
- configuration
- file
- default
- operating system
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域Technical field
本申请涉及计算机软件,尤其涉及一种配置文件同步方法及相关设备。The present application relates to computer software, and in particular, to a configuration file synchronization method and related equipment.
背景技术Background technique
电子设备变更操作系统(例如更换操作系统或升级操作系统)时,需要对电子设备中的软件进行重新部署。对软件进行重新部署时,需要对软件的配置文件进行同步。目前的配置文件同步大多是在业务层实现,针对性较强,不同的软件有各自的同步方法,不具备通用性,同步的效率较低。When the operating system of an electronic device is changed (for example, the operating system is replaced or upgraded), the software in the electronic device needs to be redeployed. When redeploying software, the software configuration files need to be synchronized. The current configuration file synchronization is mostly implemented at the business layer, which is highly targeted. Different software has its own synchronization method, which is not universal and the synchronization efficiency is low.
发明内容Contents of the invention
本申请实施例提供了一种配置文件同步方法及相关设备,能够提高配置文件同步的效率。Embodiments of the present application provide a configuration file synchronization method and related equipment, which can improve the efficiency of configuration file synchronization.
本申请第一方面公开了一种配置文件同步方法,所述方法包括:获取原操作系统的第一默认配置文件和目标操作系统的第二默认配置文件,生成配置描述文件,配置描述文件包括第一默认配置文件和第二默认配置文件的配置描述信息;获取电子设备在原操作系统下的配置文件;根据第一默认配置文件、第二默认配置文件、电子设备在原操作系统下的配置文件和配置描述文件,生成配置差异信息,配置差异信息描述第一默认配置文件相较于第二默认配置文件、电子设备在原操作系统下的配置文件存在的差异以及是否同步差异;根据第二默认配置文件、配置描述文件和配置差异信息,生成目标配置文件;根据目标配置文件对电子设备在目标操作系统下的配置文件进行同步。A first aspect of this application discloses a configuration file synchronization method. The method includes: obtaining the first default configuration file of the original operating system and the second default configuration file of the target operating system, and generating a configuration description file. The configuration description file includes a first default configuration file. Configuration description information of the first default configuration file and the second default configuration file; obtain the configuration file of the electronic device under the original operating system; according to the first default configuration file, the second default configuration file, the configuration file and configuration of the electronic device under the original operating system Description file, generates configuration difference information, the configuration difference information describes the differences between the first default configuration file and the second default configuration file, the configuration file of the electronic device under the original operating system, and whether the differences are synchronized; according to the second default configuration file, Configure the description file and configuration difference information to generate a target configuration file; synchronize the configuration file of the electronic device under the target operating system according to the target configuration file.
根据本申请实施例提供的配置文件同步方法,可以在操作系统发生变更(从原操作系统变更为目标操作系统)时,对配置文件进行同步,提升对软件进行重新部署的效率。该配置文件同步方法支持对操作系统下各种软件的配置文件进行识别,不需要对软件进行特定识别,对不同的软件具备通用性。该配置文件同步方法能够分析原操作系统下发生变化的配置文件,无需人工排查,较少了工作量,防止漏分析。该配置文件同步方法可以批量同步配置,提升配置同步效率,同时减少人工导致同步配置出错概率。According to the configuration file synchronization method provided by the embodiment of the present application, when the operating system is changed (from the original operating system to the target operating system), the configuration file can be synchronized, thereby improving the efficiency of software redeployment. This configuration file synchronization method supports the identification of configuration files of various software under the operating system, does not require specific identification of the software, and is versatile for different software. This configuration file synchronization method can analyze the configuration files that have changed under the original operating system, without the need for manual investigation, reducing the workload and preventing leakage of analysis. This configuration file synchronization method can synchronize configurations in batches, improve configuration synchronization efficiency, and reduce the probability of manual synchronization configuration errors.
在一些可选的实施方式中,获取原操作系统的第一默认配置文件和目标操作系统的第二默认配置文件,生成配置描述文件包括:获取原操作系统的第一全量软件包和目标操作系统的第二全量软件包;对第一全量软件包和第二全量软件包进行解压缩;从第一全量软件包解压缩得到的文件中查找第一默认配置文件,从第二全量软件包解压缩得到的文件中查找第二默认配置文件;将第一默认配置文件和第二默认配置文件对应的配置描述信息写入配置描述文件。In some optional implementations, obtaining the first default configuration file of the original operating system and the second default configuration file of the target operating system, and generating the configuration description file includes: obtaining the first full software package of the original operating system and the target operating system. the second full software package; decompress the first full software package and the second full software package; search for the first default configuration file from the file decompressed by the first full software package, and decompress the second full software package Search the second default configuration file in the obtained file; write the configuration description information corresponding to the first default configuration file and the second default configuration file into the configuration description file.
根据原操作系统的第一全量软件包和目标操作系统的第二全量软件包,可以得到原操作系统的第一默认配置文件和目标操作系统的第二默认配置文件,对第一默认配置文件和目标操作系统的第二默认配置文件进行分析,可以得到配置描述文件。According to the first full software package of the original operating system and the second full software package of the target operating system, the first default configuration file of the original operating system and the second default configuration file of the target operating system can be obtained. For the first default configuration file and The second default configuration file of the target operating system is analyzed to obtain the configuration description file.
在一些可选的实施方式中,从第一全量软件包解压缩得到的文件中查找第一默认配置文件包括:从第一全量软件包解压缩得到的文件中查找文本文件;根据预设文件类型从文本文件中查找第一默认配置文件。In some optional implementations, searching for the first default configuration file from the files decompressed by the first full software package includes: searching for text files from the files decompressed by the first full software package; according to the preset file type Find the first default configuration file from a text file.
从第一全量软件包解压缩得到的文件中查找文本文件,根据预设文件类型从文本文件中查找第一默认配置文件,可以快速查找到第一默认配置文件。Search the text file from the file obtained by decompressing the first full software package, and search the first default configuration file from the text file according to the preset file type, so that the first default configuration file can be quickly found.
在一些可选的实施方式中,所述方法还包括:将第一默认配置文件和第二默认配置文件打包成资源文件。In some optional implementations, the method further includes: packaging the first default configuration file and the second default configuration file into a resource file.
将第一默认配置文件和第二默认配置文件打包成资源文件,可以便于对不同的电子设备使用将第一默认配置文件和第二默认配置文件进行配置文件同步。Packing the first default configuration file and the second default configuration file into resource files can facilitate configuration file synchronization of the first default configuration file and the second default configuration file for different electronic devices.
在一些可选的实施方式中,根据第一默认配置文件、第二默认配置文件、电子设备在原操作系统下的配置文件和配置描述文件,生成配置差异信息包括:根据配置描述文件比较第一默认配置文件与第二默认配置文件,得到第一差异;根据配置描述文件比较第一默认配置文件与电子设备在原操作系统下的配置文件,得到第二差异;根据第一差异和第二差异,生成配置差异信息。In some optional implementations, generating configuration difference information based on the first default configuration file, the second default configuration file, the configuration file of the electronic device under the original operating system, and the configuration description file includes: comparing the first default configuration file according to the configuration description file. The first difference is obtained between the configuration file and the second default configuration file; the first default configuration file is compared with the configuration file of the electronic device under the original operating system according to the configuration description file, and the second difference is obtained; based on the first difference and the second difference, a generated Configuration difference information.
配置差异信息描述第一默认配置文件相较于第二默认配置文件、电子设备在原操作系统下的配置文件存在的差异以及是否同步差异,通过比较第一默认配置文件与第二默认配置文件,以及比较第一默认配置文件与电子设备在原操作系统下的配置文件,可以得到配置差异信息。The configuration difference information describes the differences between the first default configuration file and the second default configuration file, the configuration files of the electronic device under the original operating system, and whether the differences are synchronized, by comparing the first default configuration file with the second default configuration file, and Configuration difference information can be obtained by comparing the first default configuration file with the configuration file of the electronic device under the original operating system.
在一些可选的实施方式中,所述方法还包括:根据第二默认配置文件、配置描述文件和配置差异信息,生成配置文件同步脚本。In some optional implementations, the method further includes: generating a configuration file synchronization script based on the second default configuration file, the configuration description file, and the configuration difference information.
基于配置文件同步脚本,可以快速地对配置文件进行同步。Based on the configuration file synchronization script, configuration files can be synchronized quickly.
在一些可选的实施方式中,根据第二默认配置文件、配置描述文件和配置差异信息,生成目标配置文件和配置文件同步脚本包括:读取配置差异信息、配置描述文件和第二默认配置文件;对于配置差异信息中的每个差异项:若差异项表示删除配置文件,生成删除脚本;若差异项表示新增配置文件,拷贝新增的配置文件,生成拷贝脚本;若差异项表示新增、修改或删除配置项,根据配置描述文件对第二默认配置文件进行修改,生成拷贝脚本。In some optional implementations, generating the target configuration file and the configuration file synchronization script based on the second default configuration file, the configuration description file, and the configuration difference information include: reading the configuration difference information, the configuration description file, and the second default configuration file. ; For each difference item in the configuration difference information: if the difference item represents deletion of the configuration file, generate a deletion script; if the difference item represents a new configuration file, copy the newly added configuration file and generate a copy script; if the difference item represents a new addition , modify or delete configuration items, modify the second default configuration file according to the configuration description file, and generate a copy script.
针对配置差异信息中描述的差异的不同情况,进行不同的处理,从而得到目标配置文件和配置文件同步脚本。Perform different processing according to different situations of the differences described in the configuration difference information, thereby obtaining the target configuration file and the configuration file synchronization script.
在一些可选的实施方式中,配置描述信息包括配置文件属组、配置文件路径、配置文件类型、配置文件解析规则和配置文件同步规则。In some optional implementations, the configuration description information includes configuration file group, configuration file path, configuration file type, configuration file parsing rules, and configuration file synchronization rules.
在一些可选的实施方式中,配置差异信息包括配置文件路径、原操作系统、目标操作系统、处理器架构、配置文件属组、第一默认配置值、第二默认配置值、原配置值、是否存在第一差异、是否存在第二差异、是否对差异进行同步。In some optional implementations, the configuration difference information includes configuration file path, original operating system, target operating system, processor architecture, configuration file group, first default configuration value, second default configuration value, original configuration value, Whether there is a first difference, whether there is a second difference, and whether the differences are synchronized.
本申请第二方面公开了一种计算机可读存储介质,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如第一方面所述的配置文件同步方法。A second aspect of the present application discloses a computer-readable storage medium, which includes computer instructions. When the computer instructions are run on an electronic device, the electronic device causes the electronic device to execute the configuration file synchronization method as described in the first aspect.
本申请第三方面公开了一种电子设备,所述电子设备包括处理器和存储器,所述存储器,用于存储指令,所述处理器用于调用所述存储器中的指令,使得所述电子设备执行如第一方面所述的配置文件同步方法。A third aspect of this application discloses an electronic device. The electronic device includes a processor and a memory. The memory is used to store instructions. The processor is used to call instructions in the memory to cause the electronic device to execute Configuration file synchronization method as described in the first aspect.
本申请第四方面公开了一种芯片系统,该芯片系统应用于电子设备;芯片系统包括接口电路和处理器;接口电路和处理器通过线路互联;接口电路用于从电子设备的存储器接收信号,并向处理器发送信号,信号包括存储器中存储的计算机指令;当处理器执行该计算机指令时,芯片系统执行如第一方面所述的配置文件同步方法。The fourth aspect of this application discloses a chip system, which is applied to electronic equipment; the chip system includes an interface circuit and a processor; the interface circuit and the processor are interconnected through lines; the interface circuit is used to receive signals from the memory of the electronic equipment, and sends a signal to the processor, the signal includes a computer instruction stored in the memory; when the processor executes the computer instruction, the chip system executes the configuration file synchronization method as described in the first aspect.
应当理解地,上述提供的第二方面的计算机可读存储介质,第三方面的电子设备及第四方面的芯片系统均与上述第一方面的方法对应,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。It should be understood that the computer-readable storage medium of the second aspect, the electronic device of the third aspect and the chip system of the fourth aspect provided above all correspond to the method of the first aspect. Therefore, the beneficial effects they can achieve can be Refer to the beneficial effects of the corresponding methods provided above, which will not be described again here.
附图说明Description of drawings
图1是本申请实施例提供的配置文件同步方法的应用场景示意图。Figure 1 is a schematic diagram of an application scenario of the configuration file synchronization method provided by the embodiment of the present application.
图2、图3是本申请实施例提供的配置文件同步方法的流程图。Figures 2 and 3 are flow charts of the configuration file synchronization method provided by the embodiment of the present application.
图4是本申请实施例提供的获取配置文件的细化流程图。Figure 4 is a detailed flow chart of obtaining a configuration file provided by an embodiment of the present application.
图5是本申请实施例提供的多个配置文件的示意图。Figure 5 is a schematic diagram of multiple configuration files provided by this embodiment of the application.
图6是本申请实施例提供的基于配置文件生成配置差异信息的细化流程图。Figure 6 is a detailed flow chart for generating configuration difference information based on configuration files provided by an embodiment of the present application.
图7是本申请实施例提供的配置差异信息的示意图。Figure 7 is a schematic diagram of configuration difference information provided by an embodiment of the present application.
图8是本申请实施例提供的生成目标配置文件和配置文件同步脚本的细化流程图。Figure 8 is a detailed flow chart for generating a target configuration file and a configuration file synchronization script provided by an embodiment of the present application.
图9是本申请实施例提供的目标配置文件和配置文件同步脚本的示意图。Figure 9 is a schematic diagram of a target configuration file and a configuration file synchronization script provided by an embodiment of the present application.
图10是本申请实施例提供的对配置文件数据进行结构化存储的示意图。Figure 10 is a schematic diagram of structured storage of configuration file data provided by an embodiment of the present application.
图11是本申请实施例提供的电子设备的结构示意图。Figure 11 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
为了便于理解,示例性的给出了部分与本申请实施例相关概念的说明以供参考。To facilitate understanding, some descriptions of concepts related to the embodiments of the present application are exemplarily provided for reference.
需要说明的是,本申请中“至少一个”是指一个或者多个,“多个”是指两个或多于两个。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。本申请的说明书和权利要求书及附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不是用于描述特定的顺序或先后次序。It should be noted that “at least one” in this application refers to one or more, and “multiple” refers to two or more than two. "And/or" describes the association of associated objects, indicating that there can be three relationships. For example, A and/or B can mean: A exists alone, A and B exist simultaneously, and B exists alone, where A, B Can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if present) in the description, claims and drawings of this application are used to distinguish similar objects, rather than to Describe a specific order or sequence.
为了更好地理解本申请实施例提供的配置文件同步方法及相关设备,下面首先对本申请配置文件同步方法的应用场景进行描述。In order to better understand the configuration file synchronization method and related equipment provided by the embodiments of the present application, the application scenarios of the configuration file synchronization method of the present application are first described below.
图1是本申请实施例提供的配置文件同步方法的应用场景示意图。Figure 1 is a schematic diagram of an application scenario of the configuration file synchronization method provided by the embodiment of the present application.
如图1所示,本申请实施例提供的配置文件同步方法应用于电子设备10。电子设备10包括操作系统11和至少一个软件12(图上只示出一个)。软件12包括至少一个配置文件13。配置文件13提供软件12运行所需的信息。根据本申请实施例提供的配置文件同步方法,可以在操作系统11发生变更(从原操作系统变更为目标操作系统)时,对配置文件13进行同步,提升对软件12进行重新部署的效率。As shown in Figure 1, the configuration file synchronization method provided by the embodiment of the present application is applied to the electronic device 10. The electronic device 10 includes an operating system 11 and at least one piece of software 12 (only one is shown in the figure). Software 12 includes at least one configuration file 13 . Configuration file 13 provides information required for software 12 to operate. According to the configuration file synchronization method provided by the embodiment of the present application, when the operating system 11 is changed (from the original operating system to the target operating system), the configuration file 13 can be synchronized, thereby improving the efficiency of redeploying the software 12.
变更操作系统11可以是更换操作系统,例如原操作系统是CentOS 7.6,目标操作系统是openEuler 22.03。变更操作系统11也可以是升级操作系统,例如原操作系统是openEuler 21.03,目标操作系统是openEuler 22.03,或者原操作系统是CentOS 6.8,目标操作系统是CentOS 7.6。Changing the operating system 11 may be to replace the operating system. For example, the original operating system is CentOS 7.6 and the target operating system is openEuler 22.03. Changing the operating system 11 can also mean upgrading the operating system. For example, the original operating system is openEuler 21.03 and the target operating system is openEuler 22.03, or the original operating system is CentOS 6.8 and the target operating system is CentOS 7.6.
电子设备10可以是平板电脑、桌上型计算机、笔记本、云端服务器等。The electronic device 10 may be a tablet computer, a desktop computer, a notebook, a cloud server, etc.
图2、图3为本申请实施例提供的配置文件同步方法的流程图。图2、图3所示方法应用于电子设备(例如图1中电子设备10)。其中,图2侧重描述每个步骤处理或生成的数据,图3侧重描述每个步骤的具体内容。为了便于清楚完整地描述配置文件同步方法的详细流程,下文结合图2与图3对本申请实施例提供的配置文件同步方法进行说明。Figures 2 and 3 are flow charts of the configuration file synchronization method provided by the embodiment of the present application. The methods shown in Figures 2 and 3 are applied to electronic devices (such as the electronic device 10 in Figure 1). Among them, Figure 2 focuses on describing the data processed or generated in each step, and Figure 3 focuses on describing the specific content of each step. In order to facilitate a clear and complete description of the detailed process of the configuration file synchronization method, the configuration file synchronization method provided by the embodiment of the present application will be described below with reference to FIG. 2 and FIG. 3 .
如图2、3所示,本申请实施例提供的配置文件同步方法具体包括:As shown in Figures 2 and 3, the configuration file synchronization method provided by the embodiment of this application specifically includes:
201,获取原操作系统的默认配置文件(为便于区分,下文简称为“第一默认配置文件”)和目标操作系统的默认配置文件(为便于区分,下文简称为“第二默认配置文件”),生成配置描述文件。201. Obtain the default configuration file of the original operating system (for the convenience of distinction, hereinafter referred to as the "first default configuration file") and the default configuration file of the target operating system (for the convenience of the distinction, hereinafter referred to as the "second default configuration file") , generate the configuration description file.
原操作系统可以是电子设备变更操作系统前的操作系统。目标操作系统是电子设备变更操作系统后的操作系统。The original operating system may be the operating system of the electronic device before the operating system is changed. The target operating system is the operating system of the electronic device after the operating system is changed.
第一默认配置文件是原操作系统支持的软件对应的配置文件。第二默认配置文件是目标操作系统支持的软件对应的配置文件。可以获取原操作系统的全量软件包(为便于区分,下文简称为“第一全量软件包”)和目标操作系统的全量软件包(为便于区分,下文简称为“第二全量软件包”),根据第一全量软件包获取第一默认配置文件,以及根据第二全量软件包获取第二默认配置文件,生成配置描述文件(参见图2中201所示)。此外,在其他实施例中,也可以直接从存储设备中获取预先存储的第一默认配置文件和第二默认配置文件。The first default configuration file is the configuration file corresponding to the software supported by the original operating system. The second default configuration file is the configuration file corresponding to the software supported by the target operating system. You can obtain the full software package of the original operating system (for the convenience of distinction, hereinafter referred to as the "first full software package") and the full software package of the target operating system (for the convenience of distinction, hereinafter referred to as the "second full software package"), The first default configuration file is obtained according to the first full software package, and the second default configuration file is obtained according to the second full software package, and a configuration description file is generated (see 201 in Figure 2). In addition, in other embodiments, the pre-stored first default configuration file and second default configuration file may also be obtained directly from the storage device.
在一些实施例中,对于不同的处理器架构,第一默认配置文件和第二默认配置文件可以不同。例如,对于X86和ARM(例如,Advanced RISC Machine,进阶精简指令集机器,其中,RISC为精简指令集,Reduced Instruction Set Computer)架构,第一默认配置文件和第二默认配置文件不同。为了实现电子设备的配置文件同步,需要根据电子设备的处理器架构获取第一默认配置文件和第二默认配置文件,即获取与电子设备的处理器架构对应的第一默认配置文件和第二默认配置文件。In some embodiments, the first default profile and the second default profile may be different for different processor architectures. For example, for X86 and ARM (for example, Advanced RISC Machine, Advanced Reduced Instruction Set Machine, where RISC is Reduced Instruction Set Computer) architectures, the first default configuration file and the second default configuration file are different. In order to achieve configuration file synchronization of the electronic device, it is necessary to obtain the first default configuration file and the second default configuration file according to the processor architecture of the electronic device, that is, to obtain the first default configuration file and the second default configuration file corresponding to the processor architecture of the electronic device. configuration file.
配置描述文件包括第一默认配置文件、第二默认配置文件的配置描述信息。在生成配置描述文件时,获取每个配置文件对,针对每个配置文件对生成一组配置描述信息。每个配置文件对包括一个第一默认配置文件和一个对应的第二默认配置文件。例如,原操作系统下,软件A包括配置文件aa.conf,目标操作系统下,软件A包括与aa.conf对应的配置文件aa’.conf,aa.conf与aa’.conf构成一个配置文件对。The configuration description file includes configuration description information of the first default configuration file and the second default configuration file. When generating a configuration description file, each configuration file pair is obtained, and a set of configuration description information is generated for each configuration file pair. Each profile pair includes a first default profile and a corresponding second default profile. For example, under the original operating system, software A includes the configuration file aa.conf. Under the target operating system, software A includes the configuration file aa'.conf corresponding to aa.conf. aa.conf and aa'.conf form a configuration file pair. .
在本申请的一个实施例中,可以针对用户自定义的配置文件,在配置描述文件加入自定义的配置文件对应的配置描述信息,从而支持自定义的配置文件的批量同步。In one embodiment of the present application, for user-defined configuration files, configuration description information corresponding to the customized configuration files can be added to the configuration description file, thereby supporting batch synchronization of customized configuration files.
在本申请的一个实施例中,配置描述信息可以包括配置文件属组、配置文件路径、配置文件类型、配置文件解析规则和配置文件同步规则。In one embodiment of the present application, the configuration description information may include configuration file group, configuration file path, configuration file type, configuration file parsing rules, and configuration file synchronization rules.
配置文件属组表示配置文件对所属的软件,例如软件A。The configuration file group indicates the software to which the configuration file belongs, for example, software A.
配置文件路径用于描述配置文件对的安装路径。配置文件对中,若第一默认配置文件和对应的第二默认配置文件的安装路径相同,配置文件路径可以包括一个安装路径(即第一默认配置文件或对应的第二默认配置文件的安装路径),也可以包括两个相同的安装路径(即第一默认配置文件和对应的第二默认配置文件的安装路径)。若第一默认配置文件和对应的第二默认配置文件的安装路径不同,配置文件路径包括两个安装路径,分别是第一默认配置文件的安装路径和对应的第二默认配置文件的安装路径。The configuration file path is used to describe the installation path of the configuration file pair. In the configuration file pair, if the installation paths of the first default configuration file and the corresponding second default configuration file are the same, the configuration file path may include an installation path (i.e., the installation path of the first default configuration file or the corresponding second default configuration file ), may also include two identical installation paths (ie, the installation paths of the first default configuration file and the corresponding second default configuration file). If the installation paths of the first default configuration file and the corresponding second default configuration file are different, the configuration file path includes two installation paths, which are the installation path of the first default configuration file and the installation path of the corresponding second default configuration file.
配置文件类型用于描述配置文件对的文件类型,例如.xml、.json等。The configuration file type is used to describe the file type of the configuration file pair, such as .xml, .json, etc.
配置文件解析规则用于定义如何解析配置文件对中的配置项。若第一默认配置文件中的配置项和对应的第二默认配置文件中对应的配置项的名称不同,配置文件解析规则定义第一默认配置文件中的配置项和对应的第二默认配置文件中对应的配置项的映射关系。例如,第一默认配置文件中,配置项是a,对应的第二默认配置文件中,对应的配置项是aa,配置文件解析规则定义a与aa的映射关系。Configuration file parsing rules are used to define how to parse configuration items in configuration file pairs. If the names of the configuration items in the first default configuration file and the corresponding configuration items in the corresponding second default configuration file are different, the configuration file parsing rules define the names of the configuration items in the first default configuration file and the corresponding second default configuration file. The mapping relationship of the corresponding configuration items. For example, in the first default configuration file, the configuration item is a, in the corresponding second default configuration file, the corresponding configuration item is aa, and the configuration file parsing rules define the mapping relationship between a and aa.
配置文件同步规则用于定义如何对配置文件对中的配置项进行同步。例如,第一默认配置文件中,a=b,对应的第二默认配置文件中,对应的配置项是aa,配置文件解析规则定义如何对aa进行同步,即如何对aa赋值为b。Configuration file synchronization rules are used to define how to synchronize configuration items in a configuration file pair. For example, in the first default configuration file, a=b, in the corresponding second default configuration file, the corresponding configuration item is aa, and the configuration file parsing rules define how to synchronize aa, that is, how to assign a value to b.
获取第一默认配置文件和第二默认配置文件,生成配置描述文件的具体过程在图4中进行描述。The specific process of obtaining the first default configuration file and the second default configuration file and generating the configuration description file is described in Figure 4.
202,获取电子设备在原操作系统下的配置文件。202. Obtain the configuration file of the electronic device under the original operating system.
电子设备在原操作系统下的配置文件,是电子设备在原操作系统下安装的软件所对应的配置文件,是电子设备在原操作系统下实际包含的配置文件。The configuration file of the electronic device under the original operating system is the configuration file corresponding to the software installed on the electronic device under the original operating system, and is the configuration file actually included in the electronic device under the original operating system.
电子设备可以查询电子设备在原操作系统下安装的软件,根据电子设备在原操作系统下安装的软件获取电子设备在原操作系统下的配置文件。The electronic device can query the software installed on the electronic device under the original operating system, and obtain the configuration file of the electronic device under the original operating system based on the software installed on the electronic device under the original operating system.
电子设备在原操作系统下的配置文件和第一默认配置文件对应的软件可以相同。例如,电子设备在原操作系统下的配置文件对应的软件(即电子设备在原操作系统下安装的软件)包括软件A、软件B、软件C、软件D、软件E,第一默认配置文件对应的软件(即原操作系统支持的软件)包括软件A、软件B、软件C、软件D、软件E。The configuration file of the electronic device under the original operating system and the software corresponding to the first default configuration file can be the same. For example, the software corresponding to the configuration file of the electronic device under the original operating system (that is, the software installed on the electronic device under the original operating system) includes software A, software B, software C, software D, software E, and the software corresponding to the first default configuration file (That is, the software supported by the original operating system) includes software A, software B, software C, software D, and software E.
电子设备在原操作系统下的配置文件和第一默认配置文件对应的软件也可以不同。电子设备在原操作系统下的配置文件对应的软件包括软件A、软件B、软件C、软件D,第一默认配置文件对应的软件(即原操作系统支持的软件)包括软件A、软件B、软件C、软件D、软件E。The configuration file of the electronic device under the original operating system and the software corresponding to the first default configuration file may also be different. The software corresponding to the configuration file of the electronic device under the original operating system includes software A, software B, software C, and software D. The software corresponding to the first default configuration file (that is, the software supported by the original operating system) includes software A, software B, software C. Software D. Software E.
对于同一软件,电子设备在原操作系统下的配置文件和第一默认配置文件可以相同。例如,对于软件A,电子设备在原操作系统下的配置文件和第一默认配置文件包括aa.conf、ab.ini、ac.xml,并且aa.conf、ab.ini、ac.xml中的配置项相同。For the same software, the configuration file of the electronic device under the original operating system and the first default configuration file can be the same. For example, for software A, the configuration file and first default configuration file of the electronic device under the original operating system include aa.conf, ab.ini, ac.xml, and the configuration items in aa.conf, ab.ini, ac.xml same.
对于同一软件,电子设备在原操作系统下的配置文件和第一默认配置文件也可以不同(包括电子设备在原操作系统下的配置文件和第一默认配置文件相比,新增了配置文件、删除了配置文件、对配置文件中的配置项进行了修改等情况)。例如,对于软件A,电子设备在原操作系统下的配置文件包括aa.conf、ab.ini、ac.xml,第一默认配置文件包括aa.conf、ab.ini。For the same software, the configuration file of the electronic device under the original operating system and the first default configuration file can also be different (including whether the configuration file of the electronic device under the original operating system is compared with the first default configuration file, new configuration files, deleted configuration file, modification of configuration items in the configuration file, etc.). For example, for software A, the configuration files of the electronic device under the original operating system include aa.conf, ab.ini, and ac.xml, and the first default configuration file includes aa.conf and ab.ini.
电子设备可以通过预设命令查询电子设备在原操作系统下安装的软件。例如,可以通过“rpm-qa”命令查询电子设备在原操作系统下安装的软件,得到电子设备在原操作系统下安装的软件的目录。The electronic device can query the software installed on the electronic device under the original operating system through a preset command. For example, you can use the "rpm-qa" command to query the software installed on the electronic device under the original operating system and obtain the directory of the software installed on the electronic device under the original operating system.
电子设备可以从在原操作系统下安装的软件的目录查找配置文件,得到电子设备在原操作系统下的配置文件。The electronic device can search for the configuration file from the directory of the software installed under the original operating system to obtain the configuration file of the electronic device under the original operating system.
203,根据第一默认配置文件、第二默认配置文件、电子设备在原操作系统下的配置文件和配置描述文件,生成配置差异信息。203. Generate configuration difference information based on the first default configuration file, the second default configuration file, the configuration file of the electronic device under the original operating system, and the configuration description file.
配置差异信息描述第一默认配置文件相较于第二默认配置文件、电子设备在原操作系统下的配置文件存在的差异以及是否同步该差异。The configuration difference information describes the difference between the first default configuration file and the second default configuration file, the configuration file of the electronic device under the original operating system, and whether to synchronize the differences.
在生成配置差异信息时,可以根据配置文件解析规则从第一默认配置文件中获取第一默认配置值、从第二默认配置文件获取第二默认配置值、从电子设备在原操作系统下的配置文件获取原配置值。电子设备比较第二默认配置文件与第一默认配置文件的第一差异,比较电子设备在原操作系统下的配置文件与第一默认配置文件的第二差异,根据第一差异和第二差异得到配置差异信息。When generating configuration difference information, the first default configuration value can be obtained from the first default configuration file according to the configuration file parsing rules, the second default configuration value can be obtained from the second default configuration file, and the configuration file of the electronic device under the original operating system can be obtained. Get the original configuration value. The electronic device compares the first difference between the second default configuration file and the first default configuration file, compares the second difference between the configuration file of the electronic device under the original operating system and the first default configuration file, and obtains the configuration based on the first difference and the second difference. Difference information.
在本申请的一个实施例中,配置差异信息包括配置文件路径、原操作系统、目标操作系统、处理器架构、配置文件属组、第一默认配置值、第二默认配置值、原配置值、是否存在第一差异、是否存在第二差异、是否对差异进行同步等信息。其中,配置文件路径是第一默认配置文件和第二默认配置文件的安装路径。In one embodiment of the present application, the configuration difference information includes configuration file path, original operating system, target operating system, processor architecture, configuration file group, first default configuration value, second default configuration value, original configuration value, Information such as whether there is a first difference, whether a second difference exists, whether the differences are synchronized, etc. Wherein, the configuration file path is the installation path of the first default configuration file and the second default configuration file.
在生成配置差异信息时,可以显示配置差异信息的设置界面,在设置界面显示生成的配置差异信息,用户可以通过设置界面对配置差异信息进行设置。When generating configuration difference information, a setting interface for the configuration difference information can be displayed. The generated configuration difference information is displayed on the setting interface, and the user can set the configuration difference information through the setting interface.
根据电子设备在原操作系统下的配置文件、第一默认配置文件、第二默认配置文件,生成配置差异信息在图5中进行描述。The generated configuration difference information is described in Figure 5 according to the configuration file, the first default configuration file, and the second default configuration file of the electronic device under the original operating system.
204,根据配置描述文件、配置差异信息和第二默认配置文件,生成目标配置文件和配置文件同步脚本。204. Generate a target configuration file and a configuration file synchronization script based on the configuration description file, configuration difference information and the second default configuration file.
脚本(Script)是使用一种特定的描述性语言,依据一定的格式编写的可执行文件。配置文件同步脚本是用于对配置文件进行同步的脚本。A script is an executable file written in a certain format using a specific descriptive language. The configuration file synchronization script is a script used to synchronize configuration files.
电子设备生成目标配置文件和配置文件同步脚本后,将目标配置文件和配置文件同步脚本拷贝到预设位置,用以在电子设备更换操作系统并重新安装软件后进行配置文件同步。预设位置可以是其他的电子设备、云端等。After the electronic device generates the target configuration file and the configuration file synchronization script, the target configuration file and the configuration file synchronization script are copied to a preset location for configuration file synchronization after the electronic device changes the operating system and reinstalls the software. The default location can be other electronic devices, the cloud, etc.
根据配置描述文件、配置差异信息和第二默认配置文件生成目标配置文件和配置文件同步脚本的具体过程可以参考在下文图7中的详细描述。For the specific process of generating the target configuration file and the configuration file synchronization script based on the configuration description file, configuration difference information and the second default configuration file, please refer to the detailed description in Figure 7 below.
205,根据目标配置文件和配置文件同步脚本,对电子设备在目标操作系统下的配置文件进行同步。205. Synchronize the configuration file of the electronic device under the target operating system according to the target configuration file and the configuration file synchronization script.
在电子设备从原操作系统变更为目标操作系统后,电子设备执行配置文件同步脚本,根据目标配置文件对电子设备在目标操作系统下的配置文件进行同步。After the electronic device changes from the original operating system to the target operating system, the electronic device executes the configuration file synchronization script to synchronize the configuration file of the electronic device under the target operating system according to the target configuration file.
通过执行配置文件同步脚本对电子设备在目标操作系统下的配置文件进行同步,可以提高配置文件同步的效率。By executing the configuration file synchronization script to synchronize the configuration files of the electronic device under the target operating system, the efficiency of configuration file synchronization can be improved.
在本申请其他的实施例中,电子设备可以生成目标配置文件而未生成配置文件同步脚本,根据目标配置文件对电子设备在目标操作系统下的配置文件进行同步。In other embodiments of the present application, the electronic device may generate a target configuration file without generating a configuration file synchronization script, and synchronize the configuration file of the electronic device under the target operating system according to the target configuration file.
根据本申请实施例提供的配置文件同步方法,可以在操作系统发生变更(从原操作系统变更为目标操作系统)时,对配置文件进行同步,提升对软件进行重新部署的效率。该配置文件同步方法支持对操作系统下各种软件的配置文件进行识别,不需要对软件进行特定识别,对不同的软件具备通用性。该配置文件同步方法能够分析原操作系统下发生变化的配置文件,无需人工排查,较少了工作量,防止漏分析。该配置文件同步方法可以批量同步配置,提升配置同步效率,同时减少人工导致同步配置出错概率。According to the configuration file synchronization method provided by the embodiment of the present application, when the operating system is changed (from the original operating system to the target operating system), the configuration file can be synchronized, thereby improving the efficiency of software redeployment. This configuration file synchronization method supports the identification of configuration files of various software under the operating system, does not require specific identification of the software, and is versatile for different software. This configuration file synchronization method can analyze the configuration files that have changed under the original operating system, without the need for manual investigation, reducing the workload and preventing leakage of analysis. This configuration file synchronization method can synchronize configurations in batches, improve configuration synchronization efficiency, and reduce the probability of manual synchronization configuration errors.
在电子设备包括多个操作系统的情况下,可以根据本申请实施例提供的配置文件同步方法,分别对每个操作系统进行配置文件同步。In the case where the electronic device includes multiple operating systems, the configuration files of each operating system can be synchronized separately according to the configuration file synchronization method provided by the embodiments of the present application.
图4是本申请实施例提供的获取配置文件的细化流程图。具体而言,图4是图2、图3中步骤201的细化流程图。Figure 4 is a detailed flow chart of obtaining a configuration file provided by an embodiment of the present application. Specifically, FIG. 4 is a detailed flow chart of step 201 in FIGS. 2 and 3 .
401,获取原操作系统的第一全量软件包和目标操作系统的第二全量软件包。401. Obtain the first full software package of the original operating system and the second full software package of the target operating system.
原操作系统的第一全量软件包是针对原操作系统提供的所有软件包,目标操作系统的第二全量软件包是针对目标操作系统提供的所有软件包。The first full software package of the original operating system is for all software packages provided by the original operating system, and the second full software package of the target operating system is for all software packages provided by the target operating system.
电子设备可以通过预设命令获取第一全量软件包和第二全量软件包。The electronic device can obtain the first full software package and the second full software package through preset commands.
电子设备可以从原操作系统和目标操作系统的官网分别获取第一全量软件包和第二全量软件包。The electronic device can obtain the first full software package and the second full software package from the official websites of the original operating system and the target operating system respectively.
第一全量软件包和第二全量软件包均包括多个软件包。每个软件包对应一个软件。Both the first full-scale software package and the second full-scale software package include multiple software packages. Each software package corresponds to a piece of software.
第一全量软件包和第二全量软件包对应的软件可以相同。例如,第一全量软件包和第二全量软件包均包括软件A、软件B、软件C、软件D、软件E的软件包。The software corresponding to the first full software package and the second full software package may be the same. For example, both the first full software package and the second full software package include software packages of software A, software B, software C, software D, and software E.
第一全量软件包和第二全量软件包对应的软件也可以不同。例如,第一全量软件包包括软件A、软件B、软件C、软件D、软件E的软件包,第二全量软件包包括软件A、软件B、软件C、软件D、软件E、软件F、软件G的软件包。The software corresponding to the first full-scale software package and the second full-scale software package may also be different. For example, the first full software package includes software packages of software A, software B, software C, software D, and software E, and the second full software package includes software A, software B, software C, software D, software E, software F, Software package for software G.
402,对第一全量软件包和第二全量软件包进行解压缩。402. Decompress the first full software package and the second full software package.
对第一全量软件包和第二全量软件包进行解压缩包括对第一全量软件包和第二全量软件包中的每个软件包进行解压缩。Decompressing the first full software package and the second full software package includes decompressing each of the first full software package and the second full software package.
例如,第一全量软件包和第二全量软件包均包括软件A、软件B、软件C、软件D、软件E的软件包,对第一全量软件包中软件A、软件B、软件C、软件D、软件E的软件包和第二全量软件包中软件A、软件B、软件C、软件D、软件E的软件包分别进行解压缩。For example, the first full-scale software package and the second full-scale software package both include software packages of software A, software B, software C, software D, and software E. For software A, software B, software C, software in the first full-scale software package, D. The software package of software E and the software packages of software A, software B, software C, software D and software E in the second full software package are decompressed respectively.
403,从第一全量软件包解压缩得到的文件中查找第一默认配置文件,从第二全量软件包解压缩得到的文件中查找第二默认配置文件。403. Search for the first default configuration file from the file decompressed by the first full software package, and search for the second default configuration file from the file decompressed by the second full software package.
可以根据配置文件的文件类型从解压缩得到的文件中查找配置文件。例如,配置文件可以包括.ini、.json、.xml、.yaml,.list、.kv等类型。You can find the configuration file from the decompressed file based on its file type. For example, configuration files can include .ini, .json, .xml, .yaml, .list, .kv and other types.
可以从解压缩得到的文件中查找文本文件,从查找到的文本文件中查找配置文件。从解压缩得到的文件中查找文本文件,从查找到的文本文件中查找配置文件,可以提高配置文件查找的效率。You can search for text files from the decompressed files and search for configuration files from the found text files. Searching for text files from decompressed files and searching for configuration files from the found text files can improve the efficiency of configuration file search.
404,将第一默认配置文件和第二默认配置文件对应的配置描述信息写入配置描述文件,将第一默认配置文件和第二默认配置文件拷贝到指定目录。404. Write the configuration description information corresponding to the first default configuration file and the second default configuration file into the configuration description file, and copy the first default configuration file and the second default configuration file to the specified directory.
在本申请的一个实施例中,配置描述信息可以包括配置文件属组、配置文件路径、配置文件类型、配置文件解析规则、配置文件同步规则。In one embodiment of the present application, the configuration description information may include configuration file group, configuration file path, configuration file type, configuration file parsing rules, and configuration file synchronization rules.
本申请对配置描述文件的格式不做限定,例如可以是.json文件、.xml文件等。This application does not limit the format of the configuration description file, for example, it can be a .json file, .xml file, etc.
405,在第一全量软件包和第二全量软件包处理完毕后,从指定目录获取第一默认配置文件和第二默认配置文件,将第一默认配置文件和第二默认配置文件打包成资源文件。405. After the first full software package and the second full software package are processed, obtain the first default configuration file and the second default configuration file from the specified directory, and package the first default configuration file and the second default configuration file into resource files. .
获取第一默认配置文件和第二默认配置文件,生成配置描述文件是配置文件同步的预处理阶段,这一步骤可以在需要配置文件同步的电子设备上执行,也可以在其他的设备上执行。例如,可以在服务器上执行,服务器可以针对不同的处理器架构、不同的原操作系统和目标操作系统获取对应的第一默认配置文件和第二默认配置文件,生成对应的配置描述文件,能够应对不同情形实现配置文件同步。Obtaining the first default configuration file and the second default configuration file and generating the configuration description file are the preprocessing stages of configuration file synchronization. This step can be performed on the electronic device that requires configuration file synchronization, or can be performed on other devices. For example, it can be executed on a server. The server can obtain the corresponding first default configuration file and the second default configuration file for different processor architectures, different original operating systems and target operating systems, generate corresponding configuration description files, and be able to cope with Implement configuration file synchronization in different situations.
图5是本申请实施例提供的多个配置文件的示意图。具体而言,图5是图2、图3中步骤201的示意图。Figure 5 is a schematic diagram of multiple configuration files provided by this embodiment of the application. Specifically, FIG. 5 is a schematic diagram of step 201 in FIG. 2 and FIG. 3 .
如图5所示,原操作系统和目标操作系统包括软件A、B、C…,软件A的配置文件包括aa.conf、ab.ini、ac.xml,软件B的配置文件包括ba.conf、bb.kv、bc.json,软件C的配置文件包括ca.xml、cb.ini、cc.kv。从软件A、B、C…的文件中获取默认配置文件(第一默认配置文件和第二默认配置文件),并生成配置描述文件。As shown in Figure 5, the original operating system and the target operating system include software A, B, C..., the configuration file of software A includes aa.conf, ab.ini, ac.xml, and the configuration file of software B includes ba.conf, bb.kv, bc.json, the configuration files of software C include ca.xml, cb.ini, cc.kv. Obtain the default configuration files (the first default configuration file and the second default configuration file) from the files of software A, B, C..., and generate a configuration description file.
图5中,配置描述文件中的配置描述信息包括配置文件属组、配置文件路径、配置文件类型、配置文件解析规则、配置文件同步规则。In Figure 5, the configuration description information in the configuration description file includes the configuration file group, configuration file path, configuration file type, configuration file parsing rules, and configuration file synchronization rules.
图6是本申请实施例提供的基于配置文件生成配置差异信息的细化流程图。具体而言,图6是图2、图3中203的细化流程图。Figure 6 is a detailed flow chart for generating configuration difference information based on configuration files provided by an embodiment of the present application. Specifically, Figure 6 is a detailed flow chart of 203 in Figures 2 and 3.
601,根据配置描述文件对第一默认配置文件与第二默认配置文件进行比较,得到第一差异。601. Compare the first default configuration file and the second default configuration file according to the configuration description file to obtain the first difference.
对第一默认配置文件与第二默认配置文件进行比较,可以包括判断第二默认配置文件中是否存在新增、删除和修改的配置项。可以对第二默认配置文件中新增、删除和修改的配置项进行标记。Comparing the first default configuration file with the second default configuration file may include determining whether there are newly added, deleted, and modified configuration items in the second default configuration file. New, deleted, and modified configuration items in the second default configuration file can be marked.
602,根据配置描述文件对第一默认配置文件与电子设备在原操作系统下的配置文件进行比较,得到第二差异。602. Compare the first default configuration file with the configuration file of the electronic device under the original operating system according to the configuration description file to obtain the second difference.
对第一默认配置文件与电子设备在原操作系统下的配置文件进行比较,可以包括判断电子设备在原操作系统下的配置文件中是否存在新增或删除的配置文件,以及电子设备在原操作系统下的配置文件中是否存在新增、删除和修改的配置项。可以对电子设备在原操作系统下的配置文件中新增或删除的配置文件、电子设备在原操作系统下的配置文件中新增、删除和修改的配置项进行标记。Comparing the first default configuration file with the configuration file of the electronic device under the original operating system may include determining whether there is a newly added or deleted configuration file in the configuration file of the electronic device under the original operating system, and whether the electronic device has a configuration file under the original operating system. Whether there are new, deleted, or modified configuration items in the configuration file. Configuration files that are added or deleted in the configuration file of the electronic device under the original operating system, and configuration items that are added, deleted, and modified in the configuration file of the electronic device in the original operating system can be marked.
603,根据第一差异和第二差异,生成配置差异信息。603. Generate configuration difference information based on the first difference and the second difference.
配置差异信息记录第一差异和第二差异,例如第二默认配置文件中新增、删除和修改的配置项、电子设备在原操作系统下的配置文件中新增或删除的配置文件、电子设备在原操作系统下的配置文件中新增、删除和修改的配置项。The configuration difference information records the first difference and the second difference, such as newly added, deleted and modified configuration items in the second default configuration file, newly added or deleted configuration files of the electronic device in the original operating system configuration file, the configuration files of the electronic device in the original operating system, etc. New, deleted, and modified configuration items in the configuration file under the operating system.
图7是本申请实施例提供的配置差异信息的示意图。具体而言,图7是图2、图3中203的示意图。Figure 7 is a schematic diagram of configuration difference information provided by an embodiment of the present application. Specifically, FIG. 7 is a schematic diagram of 203 in FIGS. 2 and 3 .
如图7所示,配置差异信息包括配置文件路径、原操作系统、目标操作系统、处理器架构、配置文件属组、第一默认配置值、第二默认配置值、原配置值、是否存在第一差异、是否存在第二差异、是否对差异进行同步。As shown in Figure 7, the configuration difference information includes configuration file path, original operating system, target operating system, processor architecture, configuration file group, first default configuration value, second default configuration value, original configuration value, and whether there is a third First difference, whether there is a second difference, and whether to synchronize the differences.
图8是本申请实施例提供的生成目标配置文件和配置文件同步脚本的细化流程图。具体而言,图8是图2、图3中204的细化流程图。Figure 8 is a detailed flow chart for generating a target configuration file and a configuration file synchronization script provided by an embodiment of the present application. Specifically, FIG. 8 is a detailed flow chart of 204 in FIG. 2 and FIG. 3 .
801,读取配置差异信息、配置描述文件和第二默认配置文件。801, read the configuration difference information, configuration description file and second default configuration file.
802,对于配置差异信息中的每个差异项,若差异项表示删除配置文件,生成删除脚本。802. For each difference item in the configuration difference information, if the difference item indicates deletion of the configuration file, generate a deletion script.
803,若差异项表示新增配置文件,拷贝新增的配置文件得到目标配置文件,生成拷贝脚本。803. If the difference item indicates a new configuration file, copy the new configuration file to obtain the target configuration file and generate a copy script.
804,若差异项表示新增、修改或删除配置项,根据配置描述文件对第二默认配置文件进行修改,生成拷贝脚本。804. If the difference item indicates adding, modifying or deleting a configuration item, modify the second default configuration file according to the configuration description file and generate a copy script.
图9是本申请实施例提供的目标配置文件和配置文件同步脚本的示意图。具体而言,图9是图2、图3中204的示意图。Figure 9 is a schematic diagram of a target configuration file and a configuration file synchronization script provided by an embodiment of the present application. Specifically, FIG. 9 is a schematic diagram of 204 in FIGS. 2 and 3 .
如图9所示,根据配置描述文件、配置差异信息和第二默认配置文件,生成目标配置文件和配置文件同步脚本。As shown in Figure 9, the target configuration file and the configuration file synchronization script are generated based on the configuration description file, configuration difference information and the second default configuration file.
在获取第一默认配置文件、第二默认配置文件时,除了对第一默认配置文件、第二默认配置文件进行打包以外,还可以对第一默认配置文件、第二默认配置文件中的数据进行结构化存储,例如将第一默认配置文件、第二默认配置文件中的数据存储至配置数据库。配置数据库可以是SQLite,MySQL或者自定义的数据库。When obtaining the first default configuration file and the second default configuration file, in addition to packaging the first default configuration file and the second default configuration file, the data in the first default configuration file and the second default configuration file can also be packaged. Structured storage, for example, stores the data in the first default configuration file and the second default configuration file into the configuration database. The configuration database can be SQLite, MySQL or a custom database.
图10是本申请实施例提供的对配置文件数据进行结构化存储的示意图。具体而言,图10是对第一默认配置文件、第二默认配置文件中的数据进行结构化存储的示意图。如图10所示,原操作系统和目标操作系统包括软件A、B、C…,软件A的配置文件包括aa.conf、ab.ini、ac.xml,软件B的配置文件包括ba.conf、bb.kv、bc.json,软件C的配置文件包括ca.xml、cb.ini、cc.kv。将软件A、B、C…的配置文件中的数据存储至配置数据库。Figure 10 is a schematic diagram of structured storage of configuration file data provided by an embodiment of the present application. Specifically, FIG. 10 is a schematic diagram of structured storage of data in the first default configuration file and the second default configuration file. As shown in Figure 10, the original operating system and the target operating system include software A, B, C..., the configuration file of software A includes aa.conf, ab.ini, ac.xml, and the configuration file of software B includes ba.conf, bb.kv, bc.json, the configuration files of software C include ca.xml, cb.ini, cc.kv. Store the data in the configuration files of software A, B, C... into the configuration database.
图11是本申请实施例公开的一种电子设备的结构示意图。可选地,图9所示的电子设备1100用于执行图2、图3、图4、图6和图8示出的方法。FIG. 11 is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application. Optionally, the electronic device 1100 shown in Figure 9 is used to perform the methods shown in Figures 2, 3, 4, 6 and 8.
电子设备1100包括至少一个处理器1101、存储器1102以及至少一个网络接口1103。Electronic device 1100 includes at least one processor 1101, memory 1102, and at least one network interface 1103.
处理器1101例如是通用中央处理器(central processing unit,CPU)、网络处理器(network processer,NP)、图形处理器(graphics processing unit,GPU)、神经网络处理器(neural-network processing units,NPU)、数据处理单元(data processing unit,DPU)、微处理器或者一个或多个用于实现本申请方案的集成电路。例如,处理器1101包括专用集成电路(application-specific integrated circuit,ASIC),可编程逻辑器件(programmable logic device,PLD)或其组合。PLD例如是复杂可编程逻辑器件(complexprogrammable logic device,CPLD)、现场可编程逻辑门阵列(field-programmable gatearray,FPGA)、通用阵列逻辑(generic array logic,GAL)或其任意组合。The processor 1101 is, for example, a general-purpose central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), or a neural-network processing unit (NPU). ), a data processing unit (DPU), a microprocessor, or one or more integrated circuits used to implement the solution of the present application. For example, the processor 1101 includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. A PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a general array logic (GAL), or any combination thereof.
存储器1102例如是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其它类型的静态存储设备,又如是随机存取存储器(random access memory,RAM)或者可存储信息和指令的其它类型的动态存储设备,又如是电可擦可编程只读存储器(electrically erasable programmable read-only Memory,EEPROM)、只读光盘(compactdisc read-only memory,CD-ROM)或其它光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其它磁存储设备,或者是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其它介质,但不限于此。可选地,存储器1102独立存在,并通过内部连接1104与处理器1101相连接。或者,可选地存储器1102和处理器1101集成在一起。The memory 1102 is, for example, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, or a random access memory (random access memory, RAM) or a device that can store information and instructions. Other types of dynamic storage devices, such as electrically erasable programmable read-only memory (EEPROM), compactdisc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compressed optical discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be used by Any other media accessed by a computer, but not limited to this. Optionally, the memory 1102 exists independently and is connected to the processor 1101 through an internal connection 1104. Alternatively, memory 1102 and processor 1101 are optionally integrated together.
网络接口1103使用任何收发器一类的装置,用于与其它设备或通信网络通信。网络接口1103例如包括有线网络接口或者无线网络接口中的至少一项。其中,有线网络接口例如为以太网接口。以太网接口例如是光接口,电接口或其组合。无线网络接口例如为无线局域网(wireless local area networks,WLAN)接口,蜂窝网络接口或其组合等。Network interface 1103 uses any transceiver-like device for communicating with other devices or communications networks. The network interface 1103 includes, for example, at least one of a wired network interface or a wireless network interface. The wired network interface is, for example, an Ethernet interface. The Ethernet interface is, for example, an optical interface, an electrical interface or a combination thereof. The wireless network interface is, for example, a wireless local area networks (WLAN) interface, a cellular network interface or a combination thereof.
在一些实施例中,处理器1101包括一个或多个CPU,如图11中所示的CPU0和CPU1。In some embodiments, processor 1101 includes one or more CPUs, such as CPU0 and CPU1 as shown in Figure 11.
在一些实施例中,电子设备1100可选地包括多个处理器,如图11中所示的处理器1101和处理器1105。这些处理器中的每一个例如是一个单核处理器(single-CPU),又如是一个多核处理器(multi-CPU)。这里的处理器可选地指一个或多个设备、电路、和/或用于处理数据(如计算机程序指令)的处理核。In some embodiments, electronic device 1100 optionally includes multiple processors, such as processor 1101 and processor 1105 as shown in FIG. 11 . Each of these processors is, for example, a single-core processor (single-CPU) or a multi-core processor (multi-CPU). Processor here optionally refers to one or more devices, circuits, and/or processing cores for processing data (eg, computer program instructions).
在一些实施例中,电子设备1100还包括内部连接1104。处理器1101、存储器1102以及至少一个网络接口1103通过内部连接1104连接。内部连接1104包括通路,在上述组件之间传送信息。可选地,内部连接1104是单板或总线。可选地,内部连接1104分为地址总线、数据总线、控制总线等。In some embodiments, electronic device 1100 also includes internal connections 1104 . The processor 1101, the memory 1102 and at least one network interface 1103 are connected through an internal connection 1104. Internal connections 1104 include pathways that carry information between the components described above. Optionally, internal connection 1104 is a single board or bus. Optionally, the internal connections 1104 are divided into address bus, data bus, control bus, etc.
在一些实施例中,电子设备1100还包括输入输出接口1106。输入输出接口1106连接到内部连接1104上。In some embodiments, the electronic device 1100 also includes an input-output interface 1106 . The input/output interface 1106 is connected to the internal connection 1104.
可选地,处理器1101通过读取存储器1102中保存的程序代码910实现上述实施例中的方法,或者,处理器1101通过内部存储的程序代码实现上述实施例中的方法。在处理器1101通过读取存储器1102中保存的程序代码910实现上述实施例中的方法的情况下,存储器1102中保存实现本申请实施例提供的方法的程序代码。Optionally, the processor 1101 implements the method in the above embodiment by reading the program code 910 stored in the memory 1102, or the processor 1101 implements the method in the above embodiment by using the internally stored program code. In the case where the processor 1101 implements the method in the above embodiment by reading the program code 910 stored in the memory 1102, the memory 1102 stores the program code that implements the method provided by the embodiment of the present application.
处理器1101实现上述功能的更多细节请参考前面各个方法实施例中的描述,在这里不再重复。For more details on how the processor 1101 implements the above functions, please refer to the descriptions in the previous method embodiments, which will not be repeated here.
本实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的配置文件同步方法。This embodiment also provides a computer storage medium that stores computer instructions. When the computer instructions are run on an electronic device, the electronic device causes the electronic device to execute the above related method steps to implement the configuration file synchronization method in the above embodiment. .
本实施例还提供了一种计算机程序产品,当该计算机程序产品在电子设备上运行时,使得电子设备执行上述相关步骤,以实现上述实施例中的配置文件同步方法。This embodiment also provides a computer program product. When the computer program product is run on an electronic device, it causes the electronic device to perform the above related steps to implement the configuration file synchronization method in the above embodiment.
另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中的配置文件同步方法。In addition, embodiments of the present application also provide a device. This device may be a chip, a component or a module. The device may include a connected processor and a memory. The memory is used to store computer execution instructions. When the device is running, The processor can execute computer execution instructions stored in the memory, so that the chip executes the configuration file synchronization method in each of the above method embodiments.
其中,本实施例提供的电子设备、计算机存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Among them, the electronic equipment, computer storage media, computer program products or chips provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the corresponding methods provided above. The beneficial effects of the method will not be repeated here.
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the above description of the embodiments, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be allocated as needed. It is completed by different functional modules, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其他的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,该模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其他的形式。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be combined. Either it can be integrated into another device, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or units, which may be in electrical, mechanical or other forms.
该作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The unit described as a separate component may or may not be physically separate. The component shown as a unit may be one physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or software functional units.
该集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application are essentially or contribute to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium , including several instructions to cause a device (which can be a microcontroller, a chip, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be covered by the protection scope of the present application. . Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210979610.5A CN117632223A (en) | 2022-08-16 | 2022-08-16 | Configuration file synchronization methods and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210979610.5A CN117632223A (en) | 2022-08-16 | 2022-08-16 | Configuration file synchronization methods and related equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117632223A true CN117632223A (en) | 2024-03-01 |
Family
ID=90027423
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210979610.5A Pending CN117632223A (en) | 2022-08-16 | 2022-08-16 | Configuration file synchronization methods and related equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117632223A (en) |
-
2022
- 2022-08-16 CN CN202210979610.5A patent/CN117632223A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110019080B (en) | Data access method and device | |
CN108959127B (en) | Address translation method, device and system | |
CN110019496B (en) | Data reading and writing method and system | |
US12001450B2 (en) | Distributed table storage processing method, device and system | |
CN106095698A (en) | OO caching write, read method and device | |
CN110688096B (en) | Method and device for constructing application program containing plug-in, medium and electronic equipment | |
CN111538651A (en) | Interface testing method, device, server and storage medium | |
CN110888972A (en) | Sensitive content identification method and device based on Spark Streaming | |
CN117632223A (en) | Configuration file synchronization methods and related equipment | |
US10146791B2 (en) | Open file rebalance | |
CN107291628B (en) | Method and apparatus for accessing data storage device | |
CN114637969A (en) | Authentication method and device for target object | |
CN112612530B (en) | Class query method and device | |
CN115883652A (en) | Cloud service adaptation method and device | |
CN115454403A (en) | Page construction method and device and storage medium | |
CN114328435A (en) | Stream processing method and system of unstructured file based on distributed architecture | |
CN114064429A (en) | Audit log acquisition method and device, storage medium and server | |
CN114547055A (en) | Data processing method and device | |
US12273417B2 (en) | System and method for managing end point presenting devices | |
US12197461B2 (en) | Distributed function data transformation system | |
CN114237624B (en) | Error handling method, device, equipment, medium and product based on Go language | |
CN118069568B (en) | External device topology configuration method, data processor, device and program product | |
WO2023143061A1 (en) | Data access method and data access system thereof | |
CN117689132A (en) | Processing method and device of flow form, electronic equipment and storage medium | |
CN116049155A (en) | Method, device and storage medium for processing data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |