Compare commits
No commits in common. "464f4d09e76fa9ebf1ce647eaca5f09de328c52a" and "03cf86d20b26c33070b43dcc3527aa2d81c44a3b" have entirely different histories.
464f4d09e7
...
03cf86d20b
7
lineage-android-build-files/README.md
Normal file
7
lineage-android-build-files/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
These files need to be deployed into your Android source code directory to ensure build.prop file on the device contains the correct URL for receiving OTA updates. This is to point the updated app at the OTA server you're hosting.
|
||||
|
||||
1. Create the directory lineage/vendor/extra
|
||||
2. Review and edit the contents of file product.prop to ensure the URL is what you want your device pointed to.
|
||||
3. Place the product.mk and product.prop files in this directory
|
||||
|
||||
The files will then be automatically read by the build system and patch build.prop with the updated URL.
|
1
lineage-android-build-files/product.mk
Normal file
1
lineage-android-build-files/product.mk
Normal file
@ -0,0 +1 @@
|
||||
TARGET_PRODUCT_PROP += $(COMMON_PATH)/product.prop
|
1
lineage-android-build-files/product.prop
Normal file
1
lineage-android-build-files/product.prop
Normal file
@ -0,0 +1 @@
|
||||
lineage.updater.uri=https://lineage-ota.deadbeef.codes
|
44
main.go
44
main.go
@ -81,8 +81,13 @@ func updateROMCache(romDirectory string) {
|
||||
|
||||
for i, v := range files {
|
||||
|
||||
isLineageROM, splitName := isLineageROMZip(v)
|
||||
if !isLineageROM {
|
||||
// skip directories
|
||||
if v.Type().IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
// skip non .zip files
|
||||
if !strings.HasSuffix(v.Name(), ".zip") {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -94,6 +99,11 @@ func updateROMCache(romDirectory string) {
|
||||
}
|
||||
romCache.Unlock()
|
||||
|
||||
// Parse filename and skip files that can't be parsed
|
||||
splitName := strings.Split(v.Name(), "-")
|
||||
if len(splitName) != 5 {
|
||||
continue
|
||||
}
|
||||
go func(v fs.DirEntry) {
|
||||
fInfo, err := v.Info()
|
||||
if err != nil {
|
||||
@ -147,10 +157,19 @@ func moveBuildArtifacts(outDirectory, romDirectory string) bool {
|
||||
var newROMs bool
|
||||
|
||||
for _, v := range files {
|
||||
if isLineageROM, _ := isLineageROMZip(v); !isLineageROM { // skip files that aren't LineageOS ROMs
|
||||
// skip directories
|
||||
if v.Type().IsDir() {
|
||||
continue
|
||||
}
|
||||
// skip non .zip files
|
||||
if !strings.HasSuffix(v.Name(), ".zip") {
|
||||
continue
|
||||
}
|
||||
// Parse filename and skip files that can't be parsed
|
||||
splitName := strings.Split(v.Name(), "-")
|
||||
if len(splitName) != 5 {
|
||||
continue
|
||||
}
|
||||
|
||||
newROMs = true
|
||||
log.Printf("new build found - moving file %s", v.Name())
|
||||
err := moveBuildFile(fmt.Sprintf("%s/%s", outDirectory, v.Name()), fmt.Sprintf("%s/%s", romDirectory, v.Name()))
|
||||
@ -163,22 +182,6 @@ func moveBuildArtifacts(outDirectory, romDirectory string) bool {
|
||||
return newROMs
|
||||
}
|
||||
|
||||
// false if a file is not a LineageOS ROM .zip file
|
||||
// no formal validation is performed - only file naming convention is checked
|
||||
// also returns a lineage ROM's filename sliced and delimited by -'s
|
||||
// Example filename: lineage-20.0-20230604-UNOFFICIAL-sunfish.zip
|
||||
func isLineageROMZip(v fs.DirEntry) (bool, []string) {
|
||||
|
||||
// skip directories, non .zip files and files that don't begin with lineage-
|
||||
if v.Type().IsDir() || !strings.HasSuffix(v.Name(), ".zip") || !strings.HasPrefix(v.Name(), "lineage-") {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
splitName := strings.Split(v.Name(), "-")
|
||||
// expect 5 dashes
|
||||
return len(splitName) == 5, splitName
|
||||
}
|
||||
|
||||
// http - GET /
|
||||
// Writes JSON response for the updater app to know what versions are available to download
|
||||
func lineageOSROMListHandler(w http.ResponseWriter, r *http.Request) {
|
||||
@ -205,7 +208,6 @@ func lineageOSROMListHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}()
|
||||
}
|
||||
|
||||
// Returns a sha256 hash of a file located at the path provided
|
||||
func hashFile(filename string) (string, error) {
|
||||
f, err := os.Open(filename)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user