From d0c24c50d9857254f5d32cf53adb0091ceaa1fa6 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Fri, 11 Oct 2013 20:28:00 -0400 Subject: fix getting and setting contexts in selinux recreate lost+found with selinux contexts Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3 --- libtar/append.c | 15 ++++----------- libtar/extract.c | 3 ++- partition.cpp | 9 +++++++++ partitionmanager.cpp | 1 - twrp.cpp | 10 +++++++++- twrpTar.cpp | 9 +++++++-- 6 files changed, 31 insertions(+), 16 deletions(-) diff --git a/libtar/append.c b/libtar/append.c index 3a8bfc690..dcd864984 100644 --- a/libtar/append.c +++ b/libtar/append.c @@ -92,29 +92,22 @@ tar_append_file(TAR *t, char *realname, char *savename) #ifdef HAVE_SELINUX /* get selinux context */ - if(t->options & TAR_STORE_SELINUX) - { - if(t->th_buf.selinux_context != NULL) - { + if(t->options & TAR_STORE_SELINUX) { + if(t->th_buf.selinux_context != NULL) { free(t->th_buf.selinux_context); t->th_buf.selinux_context = NULL; } security_context_t selinux_context = NULL; - if(getfilecon(realname, &selinux_context) >= 0) - { + if (lgetfilecon(realname, &selinux_context) >= 0) { t->th_buf.selinux_context = strdup(selinux_context); + printf("setting selinux context: %s\n", selinux_context); freecon(selinux_context); } else - { -#ifdef DEBUG perror("Failed to get selinux context"); -#endif - } } #endif - /* check if it's a hardlink */ #ifdef DEBUG puts(" tar_append_file(): checking inode cache for hardlink..."); diff --git a/libtar/extract.c b/libtar/extract.c index d19ba859d..8081aa2b9 100644 --- a/libtar/extract.c +++ b/libtar/extract.c @@ -161,8 +161,9 @@ tar_extract_file(TAR *t, char *realname, char *prefix) #ifdef DEBUG printf(" Restoring SELinux context %s to file %s\n", t->th_buf.selinux_context, realname); #endif - if(setfilecon(realname, t->th_buf.selinux_context) < 0) + if (lsetfilecon(realname, t->th_buf.selinux_context) < 0) { fprintf(stderr, "Failed to restore SELinux context %s!\n", strerror(errno)); + } } #endif diff --git a/partition.cpp b/partition.cpp index c1c99f6f2..10cfb9f27 100644 --- a/partition.cpp +++ b/partition.cpp @@ -53,6 +53,9 @@ extern "C" { #include "make_ext4fs.h" #endif } +#ifdef HAVE_SELINUX +#include "selinux/selinux.h" +#endif using namespace std; @@ -1272,6 +1275,12 @@ bool TWPartition::Wipe_EXT4() { LOGERR("Unable to wipe '%s' using function call.\n", Mount_Point.c_str()); return false; } else { + #ifdef HAVE_SELINUX + string sedir = Mount_Point + "/lost+found"; + PartitionManager.Mount_By_Path(sedir.c_str(), true); + rmdir(sedir.c_str()); + mkdir(sedir.c_str(), S_IRWXU | S_IRWXG | S_IWGRP | S_IXGRP); + #endif return true; } #else diff --git a/partitionmanager.cpp b/partitionmanager.cpp index ca93a2ab1..445e4b563 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -901,7 +901,6 @@ int TWPartitionManager::Run_Restore(string Restore_Name) { end_pos = Restore_List.find(";", start_pos); } } - TWFunc::GUI_Operation_Text(TW_UPDATE_SYSTEM_DETAILS_TEXT, "Updating System Details"); Update_System_Details(); UnMount_Main_Partitions(); diff --git a/twrp.cpp b/twrp.cpp index 765cad342..56ffedb90 100644 --- a/twrp.cpp +++ b/twrp.cpp @@ -104,10 +104,18 @@ int main(int argc, char **argv) { gui_loadResources(); #ifdef HAVE_SELINUX + if (TWFunc::Path_Exists("/prebuilt_file_contexts")) { + if (TWFunc::Path_Exists("/file_contexts")) { + printf("Renaming regular /file_contexts -> /file_contexts.bak\n"); + rename("/file_contexts", "/file_contexts.bak"); + } + printf("Moving /prebuilt_file_contexts -> /file_contexts\n"); + rename("/prebuilt_file_contexts", "/file_contexts"); + } struct selinux_opt selinux_options[] = { { SELABEL_OPT_PATH, "/file_contexts" } }; - selinux_handle = selabel_open(SELABEL_CTX_FILE, selinux_options, 1); + selinux_handle = selabel_open(SELABEL_CTX_FILE, selinux_options, 1); if (!selinux_handle) printf("No file contexts for SELinux\n"); else diff --git a/twrpTar.cpp b/twrpTar.cpp index 9c151b939..534049f97 100644 --- a/twrpTar.cpp +++ b/twrpTar.cpp @@ -34,6 +34,7 @@ extern "C" { #include #include #include +#include #include #include "twrpTar.hpp" #include "twcommon.h" @@ -532,7 +533,7 @@ int twrpTar::Generate_Multiple_Archives(string Path) { continue; // Skip /data/media if (de->d_type == DT_BLK || de->d_type == DT_CHR) continue; - if (de->d_type == DT_DIR && strcmp(de->d_name, ".") != 0 && strcmp(de->d_name, "..") != 0 && strcmp(de->d_name, "lost+foud") != 0) + if (de->d_type == DT_DIR && strcmp(de->d_name, ".") != 0 && strcmp(de->d_name, "..") != 0) { unsigned long long folder_size = TWFunc::Get_Folder_Size(FileName, false); if (Archive_Current_Size + folder_size > MAX_ARCHIVE_SIZE) { @@ -717,7 +718,11 @@ int twrpTar::tarDirs(bool include_root) { if (strcmp(de->d_name, ".") != 0) { subfolder += de->d_name; } else { - LOGINFO("addFile '%s' including root: %i\n", buf, include_root); + std::string parentDir = basename(subfolder.c_str()); + LOGINFO("parentDir: %s\n", parentDir.c_str()); + if (!parentDir.compare("lost+found")) + continue; + LOGINFO("tarDirs addFile '%s' including root: %i\n", subfolder.c_str(), include_root); if (addFile(subfolder, include_root) != 0) return -1; continue; -- cgit v1.2.3 From 7d5b71cbe22b3ba459d811d619b973d70a4ba024 Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Fri, 18 Oct 2013 17:10:12 +0000 Subject: Clean up init.rc --- etc/init.htc.rc | 65 --------------------------------------------------------- etc/init.rc | 8 ------- 2 files changed, 73 deletions(-) delete mode 100755 etc/init.htc.rc diff --git a/etc/init.htc.rc b/etc/init.htc.rc deleted file mode 100755 index 28aa052fb..000000000 --- a/etc/init.htc.rc +++ /dev/null @@ -1,65 +0,0 @@ -on early-init - start ueventd - -on init - export PATH /sbin - export LD_LIBRARY_PATH .:/sbin - export ANDROID_ROOT /system - export ANDROID_DATA /data - export EXTERNAL_STORAGE /sdcard - - symlink /system/etc /etc - symlink /sbin/busybox /sbin/sh - - chmod 0755 /sbin/busybox - - mkdir /sdcard - mkdir /system - mkdir /data - mkdir /data/data - mkdir /cache - mkdir /mtdcache - mkdir /devlog - mkdir /internal_sdcard - mount /tmp /tmp tmpfs - -on boot - - ifup lo - hostname localhost - domainname localdomain - - class_start default - -service ueventd /sbin/ueventd - critical - -service choice_fn /sbin/choice_fn -oneshot - -service recovery /sbin/recovery -disabled - -service power_test /sbin/power_test -disabled -oneshot - -service offmode_charging /sbin/offmode_charging -disabled -oneshot - -service detect_key /sbin/detect_key -disabled -oneshot - -service htcbatt /sbin/htcbatt -oneshot - -service adbd /sbin/adbd recovery - disabled - -on property:persist.service.adb.enable=1 - start adbd - -on property:persist.service.adb.enable=0 - stop adbd diff --git a/etc/init.rc b/etc/init.rc index 57450b1f2..5e5bbf45a 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -10,16 +10,8 @@ on init export ANDROID_DATA /data export EXTERNAL_STORAGE /sdcard - symlink /system/etc /etc - mkdir /boot mkdir /recovery - mkdir /sdcard - mkdir /internal_sd - mkdir /external_sd - mkdir /sd-ext - mkdir /datadata - mkdir /emmc mkdir /system mkdir /data mkdir /cache -- cgit v1.2.3 From 4c07ab3c0e4ee092290b27863f888960456b5a22 Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Tue, 8 Oct 2013 14:04:55 +0000 Subject: Add toolbox_recovery rules Build special limited toolbox with SELinux tools for recovery Change-Id: Ifc76a6bd0468a72081f15ede2a68adf48af8a0f2 --- Android.mk | 7 ++++- prebuilt/Android.mk | 1 + toolbox/Android.mk | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 toolbox/Android.mk diff --git a/Android.mk b/Android.mk index 8fc99b2ac..bec425a94 100644 --- a/Android.mk +++ b/Android.mk @@ -271,6 +271,10 @@ include $(CLEAR_VARS) # Create busybox symlinks... gzip and gunzip are excluded because those need to link to pigz instead BUSYBOX_LINKS := $(shell cat external/busybox/busybox-full.links) exclude := tune2fs mke2fs mkdosfs gzip gunzip +ifeq ($(TWHAVE_SELINUX), true) + exclude += ls + # toolbox will provide ls support with ls -Z capability for listing SELinux contexts +endif RECOVERY_BUSYBOX_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS)))) $(RECOVERY_BUSYBOX_SYMLINKS): BUSYBOX_BINARY := busybox $(RECOVERY_BUSYBOX_SYMLINKS): $(LOCAL_INSTALLED_MODULE) @@ -338,7 +342,8 @@ include $(commands_recovery_local_path)/injecttwrp/Android.mk \ $(commands_recovery_local_path)/libcrecovery/Android.mk \ $(commands_recovery_local_path)/libblkid/Android.mk \ $(commands_recovery_local_path)/minuitwrp/Android.mk \ - $(commands_recovery_local_path)/openaes/Android.mk + $(commands_recovery_local_path)/openaes/Android.mk \ + $(commands_recovery_local_path)/toolbox/Android.mk ifeq ($(TW_INCLUDE_CRYPTO_SAMSUNG), true) include $(commands_recovery_local_path)/crypto/libcrypt_samsung/Android.mk diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk index 0169fb89d..f1777c6ca 100644 --- a/prebuilt/Android.mk +++ b/prebuilt/Android.mk @@ -46,6 +46,7 @@ RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbmlutils.so RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libflashutils.so RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libstlport.so #RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmincrypt.so +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/toolbox ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext4_utils.so endif diff --git a/toolbox/Android.mk b/toolbox/Android.mk new file mode 100644 index 000000000..ef0593a04 --- /dev/null +++ b/toolbox/Android.mk @@ -0,0 +1,80 @@ +LOCAL_PATH:= system/core/toolbox/ +include $(CLEAR_VARS) + +TOOLS := \ + start \ + stop \ + getprop \ + setprop + +ifeq ($(TWHAVE_SELINUX), true) + TOOLS += \ + ls \ + getenforce \ + setenforce \ + chcon \ + restorecon \ + runcon \ + getsebool \ + setsebool \ + load_policy +endif + +LOCAL_SRC_FILES := \ + dynarray.c \ + toolbox.c \ + $(patsubst %,%.c,$(TOOLS)) + +TOOLS += reboot + +ifeq ($(BOARD_USES_BOOTMENU),true) + LOCAL_SRC_FILES += ../../../external/bootmenu/libreboot/reboot.c +else + LOCAL_SRC_FILES += reboot.c +endif + +LOCAL_C_INCLUDES := bionic/libc/bionic + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + liblog \ + libc + +ifeq ($(TWHAVE_SELINUX), true) + LOCAL_SHARED_LIBRARIES += libselinux +endif + +LOCAL_MODULE := toolbox_recovery +LOCAL_MODULE_STEM := toolbox +LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin +LOCAL_MODULE_TAGS := optional + +# Including this will define $(intermediates). +# +include $(BUILD_EXECUTABLE) + +$(LOCAL_PATH)/toolbox.c: $(intermediates)/tools.h + +TOOLS_H := $(intermediates)/tools.h +$(TOOLS_H): PRIVATE_TOOLS := $(TOOLS) +$(TOOLS_H): PRIVATE_CUSTOM_TOOL = echo "/* file generated automatically */" > $@ ; for t in $(PRIVATE_TOOLS) ; do echo "TOOL($$t)" >> $@ ; done +$(TOOLS_H): $(LOCAL_PATH)/Android.mk +$(TOOLS_H): + $(transform-generated-source) + +# Make #!/system/bin/toolbox launchers for each tool. +# +SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(TOOLS)) +$(SYMLINKS): TOOLBOX_BINARY := $(LOCAL_MODULE_STEM) +$(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk + @echo "Symlink: $@ -> $(TOOLBOX_BINARY)" + @mkdir -p $(dir $@) + @rm -rf $@ + $(hide) ln -sf $(TOOLBOX_BINARY) $@ + +ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) + +# We need this so that the installed files could be picked up based on the +# local module name +ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ + $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) -- cgit v1.2.3 From 3c71347f5a75032bec220c69d4e5bcfeb576c570 Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Fri, 18 Oct 2013 17:12:59 +0000 Subject: Fix spelling error Change-Id: Id932ce1b99dee85feb788c513acad3384af6459e --- partition.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/partition.cpp b/partition.cpp index 10cfb9f27..093f553c0 100644 --- a/partition.cpp +++ b/partition.cpp @@ -563,9 +563,9 @@ void TWPartition::Setup_Image(bool Display_Error) { Backup_Size = Size; } else { if (Display_Error) - LOGERR("Unable to find parition size for '%s'\n", Mount_Point.c_str()); + LOGERR("Unable to find partition size for '%s'\n", Mount_Point.c_str()); else - LOGINFO("Unable to find parition size for '%s'\n", Mount_Point.c_str()); + LOGINFO("Unable to find partition size for '%s'\n", Mount_Point.c_str()); } } -- cgit v1.2.3 From d8a26e0be997c5ed70496f888b899fdb2acb0481 Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Tue, 22 Oct 2013 14:25:12 +0000 Subject: Update licenses to all match Change-Id: I3be70a897e563658736b2dec3a9ea2697b69b225 --- data.cpp | 30 ++++++++++++++++-------------- data.h | 30 ++++++++++++++++-------------- data.hpp | 30 ++++++++++++++++-------------- gui/gui.cpp | 30 ++++++++++++++++-------------- gui/gui.h | 44 +++++++++++++++++++++++++++++++------------- gui/input.cpp | 18 ++++++++++++++++++ gui/keyboard.cpp | 38 +++++++++++++++++--------------------- gui/objects.hpp | 3 ++- gui/pages.cpp | 1 + htcdumlock/htcdumlock.c | 2 +- injecttwrp/injecttwrp.c | 2 +- openrecoveryscript.cpp | 38 +++++++++++++++++--------------------- openrecoveryscript.hpp | 38 +++++++++++++++++--------------------- partition.cpp | 38 +++++++++++++++++--------------------- partitionmanager.cpp | 38 +++++++++++++++++--------------------- partitions.hpp | 38 +++++++++++++++++--------------------- tarWrite.c | 29 ++++++++++++----------------- twinstall.cpp | 17 +++++++++++++++++ twrp-functions.cpp | 18 ++++++++++++++++++ twrp-functions.hpp | 18 ++++++++++++++++++ twrpDigest.hpp | 1 + twrpTar.h | 18 ++++++++++++++++++ 22 files changed, 304 insertions(+), 215 deletions(-) diff --git a/data.cpp b/data.cpp index 0b0ad1570..c611e78fa 100644 --- a/data.cpp +++ b/data.cpp @@ -1,18 +1,20 @@ /* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #include #include diff --git a/data.h b/data.h index f9639c62f..0ca9f4eb6 100644 --- a/data.h +++ b/data.h @@ -1,18 +1,20 @@ /* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #ifndef _DATA_HEADER #define _DATA_HEADER diff --git a/data.hpp b/data.hpp index ef201d78e..723cf9b12 100644 --- a/data.hpp +++ b/data.hpp @@ -1,18 +1,20 @@ /* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #ifndef _DATAMANAGER_HPP_HEADER #define _DATAMANAGER_HPP_HEADER diff --git a/gui/gui.cpp b/gui/gui.cpp index 8329827e3..e9efc1db9 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -1,18 +1,20 @@ /* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #include #include diff --git a/gui/gui.h b/gui/gui.h index c6af2e4d1..fc3c0c47a 100644 --- a/gui/gui.h +++ b/gui/gui.h @@ -1,13 +1,31 @@ -#ifndef _GUI_HEADER -#define _GUI_HEADER - -int gui_console_only(); -int gui_init(); -int gui_loadResources(); -int gui_start(); -int gui_startPage(const char* page_name); -void gui_print(const char *fmt, ...); -void gui_print_overwrite(const char *fmt, ...); - -#endif // _GUI_HEADER - +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ + +#ifndef _GUI_HEADER +#define _GUI_HEADER + +int gui_console_only(); +int gui_init(); +int gui_loadResources(); +int gui_start(); +int gui_startPage(const char* page_name); +void gui_print(const char *fmt, ...); +void gui_print_overwrite(const char *fmt, ...); + +#endif // _GUI_HEADER + diff --git a/gui/input.cpp b/gui/input.cpp index 19e4e6a5b..4fd1d0ecf 100644 --- a/gui/input.cpp +++ b/gui/input.cpp @@ -1,3 +1,21 @@ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ + // input.cpp - GUIInput object #include diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp index 7b6d006fa..95cdbf1c8 100644 --- a/gui/keyboard.cpp +++ b/gui/keyboard.cpp @@ -1,24 +1,20 @@ -/* keyboard.cpp - GUIKeyboard object - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - * The code was written from scratch by Dees_Troy dees_troy at - * yahoo - * - * Copyright (c) 2012 - */ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #include #include diff --git a/gui/objects.hpp b/gui/objects.hpp index c259fd490..e7bb2a0ee 100644 --- a/gui/objects.hpp +++ b/gui/objects.hpp @@ -15,7 +15,8 @@ You should have received a copy of the GNU General Public License along with TWRP. If not, see . */ -// objects.h - Base classes for object manager of GUI + +// objects.hpp - Base classes for object manager of GUI #ifndef _OBJECTS_HEADER #define _OBJECTS_HEADER diff --git a/gui/pages.cpp b/gui/pages.cpp index 2bb70e170..d02dd216d 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License along with TWRP. If not, see . */ + // pages.cpp - Source to manage GUI base objects #include diff --git a/htcdumlock/htcdumlock.c b/htcdumlock/htcdumlock.c index 0bae6b890..4afa9c8e5 100644 --- a/htcdumlock/htcdumlock.c +++ b/htcdumlock/htcdumlock.c @@ -6,7 +6,7 @@ * boot once you enter the recovery. * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and + * it under the terms of the GNU General Public License version 3 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, diff --git a/injecttwrp/injecttwrp.c b/injecttwrp/injecttwrp.c index 731f9190f..e86b860ba 100644 --- a/injecttwrp/injecttwrp.c +++ b/injecttwrp/injecttwrp.c @@ -4,7 +4,7 @@ * an existing boot image. * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and + * it under the terms of the GNU General Public License version 3 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp index 87118bc67..bede6d7c2 100644 --- a/openrecoveryscript.cpp +++ b/openrecoveryscript.cpp @@ -1,24 +1,20 @@ -/* OpenRecoveryScript class for TWRP - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - * The code was written from scratch by Dees_Troy dees_troy at - * yahoo - * - * Copyright (c) 2012 - */ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #include #include diff --git a/openrecoveryscript.hpp b/openrecoveryscript.hpp index 1017d9068..45d33e646 100644 --- a/openrecoveryscript.hpp +++ b/openrecoveryscript.hpp @@ -1,24 +1,20 @@ -/* OpenRecoveryScript class for TWRP - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - * The code was written from scratch by Dees_Troy dees_troy at - * yahoo - * - * Copyright (c) 2012 - */ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #ifndef _OPENRECOVERYSCRIPT_HPP #define _OPENRECOVERYSCRIPT_HPP diff --git a/partition.cpp b/partition.cpp index 093f553c0..c1e214e52 100644 --- a/partition.cpp +++ b/partition.cpp @@ -1,24 +1,20 @@ -/* Partition class for TWRP - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - * The code was written from scratch by Dees_Troy dees_troy at - * yahoo - * - * Copyright (c) 2012 - */ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #include #include diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 445e4b563..b322932c8 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -1,24 +1,20 @@ -/* Partition Management classes for TWRP - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - * The code was written from scratch by Dees_Troy dees_troy at - * yahoo - * - * Copyright (c) 2012 - */ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #include #include diff --git a/partitions.hpp b/partitions.hpp index e46dcce28..f32f2c0c5 100644 --- a/partitions.hpp +++ b/partitions.hpp @@ -1,24 +1,20 @@ -/* Partition Management classes for TWRP - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - * The code was written from scratch by Dees_Troy dees_troy at - * yahoo - * - * Copyright (c) 2012 - */ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #ifndef __TWRP_Partition_Manager #define __TWRP_Partition_Manager diff --git a/tarWrite.c b/tarWrite.c index 7d46014bd..9b6e7217a 100644 --- a/tarWrite.c +++ b/tarWrite.c @@ -1,24 +1,19 @@ /* - Copyright 2013 bigbiff/Dees_Troy TeamWin - This file is part of TWRP/TeamWin Recovery Project. + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. - TWRP is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - TWRP is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with TWRP. If not, see . - - This is a write buffer for use with libtar. Libtar normally writes - 512 bytes at a time but this results in poor file performance - especially on exFAT fuse file systems. This write buffer fixes that - problem. + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . */ #include diff --git a/twinstall.cpp b/twinstall.cpp index 1b9c23eb4..af12ce36f 100644 --- a/twinstall.cpp +++ b/twinstall.cpp @@ -1,3 +1,20 @@ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ #include #include diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 1c0ad7590..f0c8cd430 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -1,3 +1,21 @@ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ + #include #include #include diff --git a/twrp-functions.hpp b/twrp-functions.hpp index 19ca10b2e..b580fe435 100644 --- a/twrp-functions.hpp +++ b/twrp-functions.hpp @@ -1,3 +1,21 @@ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ + #ifndef _TWRPFUNCTIONS_HPP #define _TWRPFUNCTIONS_HPP diff --git a/twrpDigest.hpp b/twrpDigest.hpp index 237e58069..2c99eb957 100644 --- a/twrpDigest.hpp +++ b/twrpDigest.hpp @@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License along with TWRP. If not, see . */ + extern "C" { #include "digest/md5.h" } diff --git a/twrpTar.h b/twrpTar.h index c5b13d4f7..a73b917e1 100644 --- a/twrpTar.h +++ b/twrpTar.h @@ -1,3 +1,21 @@ +/* + Copyright 2012 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see . +*/ + #ifndef _TWRPTAR_HEADER #define _TWRPTAR_HEADER -- cgit v1.2.3 From f4766921d4865c71c5f93b6bcc45527172934446 Mon Sep 17 00:00:00 2001 From: Dees Troy Date: Wed, 9 Oct 2013 14:45:24 +0000 Subject: Ensure root folders get added in split archives Make sure that we add the root folder itself to get the perms and SELinux contexts before splitting to a second archive. Change-Id: Id93a9f9b4767b61bba38eb0cf7306c81a8540a3c --- twrpTar.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/twrpTar.cpp b/twrpTar.cpp index 534049f97..eba482ee7 100644 --- a/twrpTar.cpp +++ b/twrpTar.cpp @@ -537,6 +537,12 @@ int twrpTar::Generate_Multiple_Archives(string Path) { { unsigned long long folder_size = TWFunc::Get_Folder_Size(FileName, false); if (Archive_Current_Size + folder_size > MAX_ARCHIVE_SIZE) { + // Add the root folder first + LOGINFO("Adding root folder '%s' before splitting.\n", FileName.c_str()); + if (addFile(FileName, true) != 0) { + LOGERR("Error adding folder '%s' to split archive.\n", FileName.c_str()); + return -1; + } LOGINFO("Calling Generate_Multiple_Archives\n"); if (Generate_Multiple_Archives(FileName) < 0) return -1; -- cgit v1.2.3 From 23f2c39906f42f88adbf8935c0482034dc23e9cf Mon Sep 17 00:00:00 2001 From: Kevin Steck Date: Thu, 17 Oct 2013 18:24:31 -0400 Subject: Skip the = or \n before grabbing Zip_File. Change-Id: I0454f8fc3cbe037fac63ef5861f8f373e4654d49 --- twrp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/twrp.cpp b/twrp.cpp index 56ffedb90..82704b51d 100644 --- a/twrp.cpp +++ b/twrp.cpp @@ -157,6 +157,9 @@ int main(int argc, char **argv) { index2 = 0; while (*ptr != '=' && *ptr != '\n') ptr++; + // skip the = before grabbing Zip_File + while (*ptr == '=') + ptr++; if (*ptr) { Zip_File = ptr; } else -- cgit v1.2.3