2017/8/3

OpenGapp

好有趣,竟然還有這個:OpenGAPP
就是把 google 的 gapp 包裝成 update file

download zip, 解開後...
update-binary 實際上是一個 shellscript。但是最終還是 call install.sh

有關 core app 部份:
for gapp_name in $core_gapps_list; do
  get_apparchives "Core/$gapp_name"
  for archive in $apparchives; do
    case $gapp_name in
      setupwizarddefault) if [ "$device_type" != "tablet" ]; then extract_app "$archive"; fi;;
      setupwizardtablet)  if [ "$device_type"  = "tablet" ]; then extract_app "$archive"; fi;;
      *)  extract_app "$archive";;
    esac
  done
done;
ui_print " ";
也就是 extract_app:
extract_app() {
  tarpath="$TMP/$1.tar" # NB no suffix specified here
  if "$TMP/unzip-$BINARCH" -o "$OPENGAZIP" "$1.tar*" -d "$TMP"; then # wildcard for suffix
    app_name="$(basename "$1")"
    which_dpi "$app_name"
    echo "Found $1 DPI path: $dpiapkpath"
    folder_extract "$tarpath" "$dpiapkpath" "$app_name/common"
  else
    echo "Failed to extract $1.tar* from $OPENGAZIP"
  fi
}
就是 folder_extract:
  elif [ -e "$archive.lz" ]; then
    for f in "$@"; do
      if [ "$f" != "unknown" ]; then
        "$TMP/tar-$BINARCH" -xf "$archive.lz" -C "$TMP" "$f" && install_extracted "$f"
      fi
    done
    rm -f "$archive.lz"
解開m,然後 install_extracted:
install_extracted() {
  file_list="$(find "$TMP/$1/" -mindepth 1 -type f | cut -d/ -f5-)"
  dir_list="$(find "$TMP/$1/" -mindepth 1 -type d | cut -d/ -f5-)"
  for file in $file_list; do
      install -D "$TMP/$1/${file}" "$SYSTEM/${file}"
      ch_con "$SYSTEM/${file}"
      set_perm 0 0 644 "$SYSTEM/${file}";
  done
  for dir in $dir_list; do
    ch_con "$SYSTEM/${dir}"
    set_perm 0 0 755 "$SYSTEM/${dir}";
  done
  case $preodex in
    true*)
      installedapkpaths="$(find "$TMP/$1/" -name "*.apk" -type f | cut -d/ -f5-)"
      for installedapkpath in $installedapkpaths; do  # TODO fix spaces-handling
        if ! checkmanifest "$SYSTEM/$installedapkpath" "classes.dex"; then
          ui_print "- pre-ODEX-ing $gapp_name";
          log "pre-ODEX-ing" "$gapp_name";
          odexapk "$SYSTEM/$installedapkpath"
        fi
      done
    ;;
  esac
  bkup_list=$'\n'"${file_list}${bkup_list}"
  rm -rf "$TMP/$1"
}

install 是 busybox 提供的...
ch_con 是 chcon:
ch_con() {
  chcon -h u:object_r:system_file:s0 "$1";
}
所以間單來說,只要 gms 的話,要裝 gms 跟 gsf . 然後 permission 也要。
所以就是解開:之後,把 priv-app push 到 /system/priv-app, 把 permission push 到 /system/etc/permissions , 把 sysconfig push 到 /system/etc/sysconfig 之後,重開機就可以。
我解開(install) 的有:
  • Core/defaultetc-comm : permissions and sysconfig
  • Core/gmscore-arm64 : PrebuiltGmsCore
  • Core/gsf-all : GoogleServiceFramework
  • Core/gsflogin-all : GoogleLoginService
-- permission 好像還是沒過,所以還是有改 framework 的 PackageManagerService, 把 Permission 都改 GRANT

沒有留言:

張貼留言