Skip to content

Instantly share code, notes, and snippets.

View fourkbomb's full-sized avatar

Simon Shields fourkbomb

View GitHub Profile
@fourkbomb
fourkbomb / osrc_download.py
Created September 28, 2017 02:42
download source releases from samsung OSRC using a terminal
#!/usr/bin/env python3
# Copyright (c) 2017 Simon Shields
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@fourkbomb
fourkbomb / dtb_diff.py
Last active June 22, 2019 07:17
basic diff between two device tree blobs, attempts to account for differing phandles
#!/usr/bin/env python
# Copyright (C) 2019 Simon Shields <simon@lineageos.org>
#
# This program 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.
#
# This program is distributed in the hope that it will be useful,
@fourkbomb
fourkbomb / README.md
Last active December 22, 2018 15:11
switch from CM to Lineage non-destructively

Switch from CyanogenMod to LineageOS without redownloading everything

  1. Init the Lineage manifest: repo init -u ssh://git@github.com/LineageOS/android.git -b cm-14.1 (or cm-13.0 if you prefer that)
  2. Update your local manifest (.repo/local_manifests/roomservice.xml), if it exists - find and replace "CyanogenMod" with "LineageOS" globally.
  3. Move the git objects: mv .repo/project-objects/CyanogenMod .repo/project-objects/LineageOS
  4. curl https://gist.github.com/fourkbomb/0d94e286dc6f173eb9053c0d75e84783/raw/cc1bb94337eab5e30efa689fe1d050db25a1124a/fixlinks.sh > ~/fixlinks.sh
  5. chmod +x ~/fixlinks.sh
  6. cd .repo/projects
  7. find . -name '*.git' -exec ~/fixlinks.sh {} \;
  8. And finally, fix the actual tree:
echo Purging old target_files...
rm out/dist/*target_files*
echo Making dist...
mka dist
echo Signing target files apks...
TARGET_FILES_SIGNED=lineage-$(get_build_var LINEAGE_VERSION)-signed-target_files.zip
./build/tools/releasetools/sign_target_files_apks -o -d ~/.android-certs out/dist/*-target_files-*.zip $TARGET_FILES_SIGNED
echo Generating ota package...
OTA_PACKAGE=lineage-$(get_build_var LINEAGE_VERSION)-install.zip
./build/tools/releasetools/ota_from_target_files -k ~/.android-certs/releasekey $TARGET_FILES_SIGNED $OTA_PACKAGE
@fourkbomb
fourkbomb / switch_default_branch.py
Last active February 12, 2018 06:01
python script using requests to change the default branch for all repos owned by a user/organisation
#!/usr/bin/python
from __future__ import print_function
import requests
BRANCH = 'cm-14.1'
REPO_OWNER = 'orgs/LineageOS'
USERNAME = 'your github username'
# generate this here: https://github.com/settings/tokens
# this script only needs the 'repo' scope
@fourkbomb
fourkbomb / unbrand.pl
Last active December 29, 2016 05:39
unbrand.sh
#!/usr/bin/perl -ni
if (/app_name/) {
s/C(?:yanogen)?M(?:od)?//g;
# strip surrounding spaces too1
s/(\S) +</$1</g;
s/> +(\S)/>$1/g;
}
print;
if (/Copyright/) {
s/20.+? /2017 /g;
@fourkbomb
fourkbomb / rebrand.pl
Last active December 29, 2016 05:39
rebrand.sh
#!/usr/bin/perl -ni
s/CyanogenMod/LineageOS/g unless /copyright/i;
print;
if (/Copyright/) {
s/20.+? /2017 /g;
s/CyanogenMod/LineageOS/;
s/Copyright/ /;
print;
}
{
"android_kernel_lge_msm8992": [
"android_device_lge_h811",
"android_device_lge_h815"
],
"android_kernel_oneplus_msm8996": [
"android_device_oneplus_oneplus3"
],
"android_kernel_htc_msm8960": [
"android_device_htc_t6spr",
{
"android_device_lge_jagnm": [
"android_device_lge_msm8226-common"
],
"android_device_lge_v410": [
"android_device_lge_v4xx-common"
],
"android_device_samsung_gts210wifi": [
"android_device_samsung_gts2-common"
],
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="fourkbomb/android_device_samsung_i9300" path="device/samsung/i9300" remote="github" revision="cm-14.0" />
<project name="fourkbomb/android_device_samsung_smdk4412-common" path="device/samsung/smdk4412-common" remote="github" revision="cm-14.0" />
<project name="fourkbomb/android_kernel_samsung_smdk4412" path="kernel/samsung/smdk4412" remote="github" revision="cm-14.0" />
<project name="CyanogenMod/android_packages_apps_SamsungServiceMode" path="packages/apps/SamsungServiceMode" remote="github" revision="cm-13.0" />
<project name="CyanogenMod/android_hardware_samsung" path="hardware/samsung" remote="github" revision="cm-14.0" />
<project name="CyanogenMod/android_external_stlport" path="external/stlport" remote="github" revision="cm-14.0" />
<project name="fourkbomb/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-14.0" />
</manifest>