summaryrefslogtreecommitdiffstats
path: root/updater/install.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2016-10-11 06:00:31 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-10-11 06:00:31 +0200
commitdf6da4adad04e003f1e8ee4ef35157db8e11c3dd (patch)
tree9b1e8590b1b8120f89d1f6e3c57755b60c0a1fd3 /updater/install.cpp
parentMerge "Update the header path for ext4_utils." am: 2bd94433f8 am: 00a9050815 am: 514dc15399 (diff)
parentRefactor libupdater into a seperate module. am: 0c7839ac14 am: cf1dbfa854 (diff)
downloadandroid_bootable_recovery-df6da4adad04e003f1e8ee4ef35157db8e11c3dd.tar
android_bootable_recovery-df6da4adad04e003f1e8ee4ef35157db8e11c3dd.tar.gz
android_bootable_recovery-df6da4adad04e003f1e8ee4ef35157db8e11c3dd.tar.bz2
android_bootable_recovery-df6da4adad04e003f1e8ee4ef35157db8e11c3dd.tar.lz
android_bootable_recovery-df6da4adad04e003f1e8ee4ef35157db8e11c3dd.tar.xz
android_bootable_recovery-df6da4adad04e003f1e8ee4ef35157db8e11c3dd.tar.zst
android_bootable_recovery-df6da4adad04e003f1e8ee4ef35157db8e11c3dd.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[]) {