1# Bundle Manager 2 3 4The Bundle Manager enables you to install, uninstall, update, and query a bundle (application). It provides the bundle debugging capabilities, for example, installing and uninstalling a bundle and querying bundle information. 5 6> **NOTE** 7> 8> Before using this tool, you must obtain the [hdc tool](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md) and run the hdc shell command. 9 10 11**Table 1** bm commands 12 13| Name| Description| 14| -------- | -------- | 15| help | Displays the commands supported by the Bundle Manager tool.| 16| install | Installs a bundle.| 17| uninstall | Uninstalls a bundle.| 18| dump | Queries bundle information.| 19| clean | Clears the cache and data of a bundle.| 20| enable | Enables a bundle. A bundle can be used after being enabled.| 21| disable | Disables a bundle. A bundle cannot be used after being disabled.| 22| get | Obtains the UDID of a device.| 23| quickfix | Performs patch-related operations, such as installing or querying a patch.| 24 25 26## Help Command 27 28**Table 2** Help command 29 30| Name| Description| 31| -------- | -------- | 32| bm help | Displays the commands supported by the bm tool.| 33 34Example 35 36 37```bash 38# Display the help information. 39bm help 40``` 41 42 43## Installation Command 44 45```bash 46bm install [-h] [-p path] [-u userId] [-r] [-w waitting-time] 47``` 48 49 50**Table 3** Installation command parameters 51 52| Name| Mandatory| Description| 53| -------- | -------- | -------- | 54| -h | No| Used to display the parameters supported by the **install** command. By default, the help information is displayed.| 55| -p | Yes| Path of the HAP to install. You can specify a path to install one or more HAPs at the same time.| 56| -u | No| User whose HAP is to be installed. By default, the current user's HAP is installed.| 57| -r | No| Whether to install the HAP in overwrite mode. By default, the HAP is installed in overwrite mode.| 58| -w | No| Time that the Bundle Manager tool waits before installing the HAP. The minimum waiting time is 5s, and the maximum waiting time is 600s. The default waiting time is 5s.| 59 60 61Example 62 63```bash 64bm install -p /data/app/ohosapp.hap -u 100 -w 5s -r 65// The execution result is as follows: 66install bundle successfully. 67``` 68 69 70## Uninstall Command 71 72```bash 73bm uninstall [-h help] [-n bundleName] [-m moduleName] [-u userId] [-k] 74``` 75 76 77**Table 4** Uninstall command parameters 78 79| Name| Mandatory| Description| 80| -------- | -------- | -------- | 81| -h | No| Used to display the parameters supported by the **uninstall** command. By default, the help information is displayed.| 82| -n | Yes| Name of the bundle to uninstall.| 83| -m | No| Module of the bundle to uninstall. By default, all modules are uninstalled.| 84| -u | No| User whose bundle is to be uninstalled. By default, the current user's bundle is uninstalled.| 85| -k | No| Whether the application data is retained when the bundle is uninstalled. By default, the application data is deleted along the uninstall.| 86 87 88Example 89 90```bash 91bm uninstall -n com.ohos.app -m com.ohos.app.MainAbility -u 100 -k 92// The execution result is as follows: 93uninstall bundle successfully. 94``` 95 96 97## Dump Command 98 99```bash 100bm dump [-h help] [-a] [-n bundleName] [-s shortcutInfo] [-u userId] [-d deviceId] 101``` 102 103 104If **-u** is not specified, the command applies to all users. 105 106 107**Table 5** Dump command parameters 108 109| Name| Mandatory| Description| 110| -------- | -------- | -------- | 111| -h | No| Used to display the parameters supported by the **dump** command. By default, the help information is displayed.| 112| -a | Yes| Used to display all bundles installed in the system.| 113| -n | Yes| Used to display the details of a bundle.| 114| -s | Yes| Used to display the shortcut information of a bundle.| 115| -d | No| Used to display the bundle information on a given device. By default, the bundle information on the current device is queried.| 116| -u | No| Used to display the bundle information for a given user. By default, the bundle information of the current user is queried.| 117 118 119Example 120 121```bash 122# Display the names of all bundles installed in the system. 123bm dump -a 124# Display the details of a bundle. 125bm dump -n com.ohos.app -u 100 126# Display the shortcut information of a bundle. 127bm dump -s com.ohos.app -u 100 128# Display cross-device bundle information. 129bm dump -n com.ohos.app -d xxxxx 130``` 131 132 133## Clean Command 134 135```bash 136bm clean [-h] [-c] [-n bundleName] [-d] [-u userId] 137``` 138 139 140If **-u** is not specified, the command applies to all active users. 141 142 143**Table 6** Clean command parameters 144 145| Name| Description| 146| -------- | -------- | 147| -h | Used to display the parameters supported by the **clean** command.| 148| -c -n | Used to clear the cache data of a bundle.| 149| -d -n | Used to clear the data directory of a bundle.| 150| -u | Used to clear the cache data of a bundle for a given user.| 151 152 153Example 154 155```bash 156# Clear the cache data of a bundle. 157bm clean -c -n com.ohos.app -u 100 158// The execution result is as follows: 159clean bundle cache files successfully. 160# Clear the user data of a bundle. 161bm clean -d -n com.ohos.app -u 100 162// The execution result is as follows: 163clean bundle data files successfully. 164``` 165 166 167## Enable Command 168 169```bash 170bm enable [-h] [-n bundleName] [-a abilityName] [-u userId] 171``` 172 173 174If **-u** is not specified, the command applies to all active users. 175 176 177**Table 7** Enable command parameters 178 179| Name| Description| 180| -------- | -------- | 181| -h | Used to display the parameters supported by the **enable** command.| 182| -n | Used to enable a bundle.| 183| -a | Used to enable an ability with a specified bundle name.| 184| -u | Used to enable a bundle for a given user.| 185 186 187Example 188 189```bash 190# Enable a bundle. 191bm enable -n com.ohos.app -a com.ohos.app.MainAbility -u 100 192// The execution result is as follows: 193enable bundle successfully. 194``` 195 196 197## Disable Command 198 199```bash 200bm disable [-h] [-n bundleName] [-a abilityName] [-u userId] 201``` 202 203 204If **-u** is not specified, the command applies to all active users. 205 206 207**Table 8** Disabled command parameters 208 209| Name| Description| 210| -------- | -------- | 211| -h | Used to display the parameters supported by the **disable** command.| 212| -n | Used to disable a bundle.| 213| -a | Used to disable an ability with a specified bundle name.| 214| -u | Used to disable a bundle for a given user.| 215 216Example 217 218```bash 219# Disable a bundle. 220bm disable -n com.ohos.app -a com.ohos.app.MainAbility -u 100 221// The execution result is as follows: 222disable bundle successfully. 223``` 224 225 226## Obtaining UDID 227 228```bash 229bm get [-h] [-u] 230``` 231 232 233**Table 9** Parameters used in the command for obtaining the UDID 234 235| Name| Description| 236| -------- | -------- | 237| -h | Used to display the parameters supported by the **get** command.| 238| -u | Used to obtain the UDID of a device.| 239 240 241Example 242 243```bash 244# Obtain the UDID of a device. 245bm get -u 246// The execution result is as follows: 247udid of current device is : 24823CADE0C 249``` 250 251 252## Quick Fix 253 254```bash 255bm quickfix [-h] [-a -f filePath] [-q -b bundleName] 256``` 257 258 259**Table 10** Parameters used in the command for quick fix 260 261| Name| Description| 262| -------- | -------- | 263| -h | Used to display the commands supported by **quickfix**.| 264| -a -f | Used to run the quick fix patch installation command. **file-path** corresponds to the hqf file. You can pass in one or more hqf files or the directory where the hqf file is located.| 265| -q -b | Used to display the patch information based on the bundle name. **bundle-name** indicates the bundle name.| 266 267 268Example 269 270```bash 271# Display patch package information by the bundle name. 272bm quickfix -q -b com.ohos.app 273// The execution result is as follows: 274// Information as follows: 275// ApplicationQuickFixInfo: 276// bundle name: com.ohos.app 277// bundle version code: xxx 278// bundle version name: xxx 279// patch version code: x 280// patch version name: 281// cpu abi: 282// native library path: 283// type: 284# Patch installation in the quick fix: 285bm quickfix -a -f /data/app/ 286// The execution result is as follows: 287apply quickfix succeed. 288``` 289