summaryrefslogtreecommitdiffstats
path: root/updater/install.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2016-10-11 05:55:00 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-10-11 05:55:00 +0200
commit3a01338332ba0eea2c07d68255c6954f62adc97e (patch)
tree091f74929951fc529f6252cf65ee03aaeff96ca5 /updater/install.cpp
parentMerge "Update the header path for ext4_utils." am: 2bd94433f8 am: 00a9050815 (diff)
parentRefactor libupdater into a seperate module. am: 0c7839ac14 (diff)
downloadandroid_bootable_recovery-3a01338332ba0eea2c07d68255c6954f62adc97e.tar
android_bootable_recovery-3a01338332ba0eea2c07d68255c6954f62adc97e.tar.gz
android_bootable_recovery-3a01338332ba0eea2c07d68255c6954f62adc97e.tar.bz2
android_bootable_recovery-3a01338332ba0eea2c07d68255c6954f62adc97e.tar.lz
android_bootable_recovery-3a01338332ba0eea2c07d68255c6954f62adc97e.tar.xz
android_bootable_recovery-3a01338332ba0eea2c07d68255c6954f62adc97e.tar.zst
android_bootable_recovery-3a01338332ba0eea2c07d68255c6954f62adc97e.zip
Diffstat (limited to 'updater/install.cpp')
-rw-r--r--updater/install.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/updater/install.cpp b/updater/install.cpp
index 24e35cfb8..86cdd5d32 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include "updater/install.h"
+
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
@@ -40,24 +42,22 @@
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <android-base/stringprintf.h>
+#include <cutils/android_reboot.h>
#include <ext4_utils/make_ext4fs.h>
#include <ext4_utils/wipe.h>
#include <selinux/label.h>
#include <selinux/selinux.h>
-#include "bootloader.h"
#include "applypatch/applypatch.h"
-#include "cutils/android_reboot.h"
-#include "cutils/misc.h"
+#include "bootloader.h"
#include "edify/expr.h"
#include "error_code.h"
#include "minzip/DirUtil.h"
#include "mounts.h"
#include "openssl/sha.h"
#include "ota_io.h"
-#include "updater.h"
-#include "install.h"
#include "tune2fs.h"
+#include "updater/updater.h"
// Send over the buffer to recovery though the command pipe.
static void uiPrint(State* state, const std::string& buffer) {
@@ -90,6 +90,27 @@ void uiPrintf(State* _Nonnull state, const char* _Nonnull format, ...) {
uiPrint(state, error_msg);
}
+// Create all parent directories of name, if necessary.
+static int make_parents(char* name) {
+ char* p;
+ for (p = name + (strlen(name)-1); p > name; --p) {
+ if (*p != '/') continue;
+ *p = '\0';
+ if (make_parents(name) < 0) return -1;
+ int result = mkdir(name, 0700);
+ if (result == 0) printf("created [%s]\n", name);
+ *p = '/';
+ if (result == 0 || errno == EEXIST) {
+ // successfully created or already existed; we're done
+ return 0;
+ } else {
+ printf("failed to mkdir %s: %s\n", name, strerror(errno));
+ return -1;
+ }
+ }
+ return 0;
+}
+
// Take a sha-1 digest and return it as a newly-allocated hex string.
char* PrintSha1(const uint8_t* digest) {
char* buffer = reinterpret_cast<char*>(malloc(SHA_DIGEST_LENGTH*2 + 1));
@@ -569,27 +590,6 @@ Value* PackageExtractFileFn(const char* name, State* state,
}
}
-// Create all parent directories of name, if necessary.
-static int make_parents(char* name) {
- char* p;
- for (p = name + (strlen(name)-1); p > name; --p) {
- if (*p != '/') continue;
- *p = '\0';
- if (make_parents(name) < 0) return -1;
- int result = mkdir(name, 0700);
- if (result == 0) printf("created [%s]\n", name);
- *p = '/';
- if (result == 0 || errno == EEXIST) {
- // successfully created or already existed; we're done
- return 0;
- } else {
- printf("failed to mkdir %s: %s\n", name, strerror(errno));
- return -1;
- }
- }
- return 0;
-}
-
// symlink target src1 src2 ...
// unlinks any previously existing src1, src2, etc before creating symlinks.
Value* SymlinkFn(const char* name, State* state, int argc, Expr* argv[]) {