Compare commits
2 Commits
03cf86d20b
...
464f4d09e7
Author | SHA1 | Date | |
---|---|---|---|
464f4d09e7 | |||
623b8f74f1 |
@ -1,7 +0,0 @@
|
|||||||
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 +0,0 @@
|
|||||||
TARGET_PRODUCT_PROP += $(COMMON_PATH)/product.prop
|
|
@ -1 +0,0 @@
|
|||||||
lineage.updater.uri=https://lineage-ota.deadbeef.codes
|
|
44
main.go
44
main.go
@ -81,13 +81,8 @@ func updateROMCache(romDirectory string) {
|
|||||||
|
|
||||||
for i, v := range files {
|
for i, v := range files {
|
||||||
|
|
||||||
// skip directories
|
isLineageROM, splitName := isLineageROMZip(v)
|
||||||
if v.Type().IsDir() {
|
if !isLineageROM {
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// skip non .zip files
|
|
||||||
if !strings.HasSuffix(v.Name(), ".zip") {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,11 +94,6 @@ func updateROMCache(romDirectory string) {
|
|||||||
}
|
}
|
||||||
romCache.Unlock()
|
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) {
|
go func(v fs.DirEntry) {
|
||||||
fInfo, err := v.Info()
|
fInfo, err := v.Info()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -157,19 +147,10 @@ func moveBuildArtifacts(outDirectory, romDirectory string) bool {
|
|||||||
var newROMs bool
|
var newROMs bool
|
||||||
|
|
||||||
for _, v := range files {
|
for _, v := range files {
|
||||||
// skip directories
|
if isLineageROM, _ := isLineageROMZip(v); !isLineageROM { // skip files that aren't LineageOS ROMs
|
||||||
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
newROMs = true
|
newROMs = true
|
||||||
log.Printf("new build found - moving file %s", v.Name())
|
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()))
|
err := moveBuildFile(fmt.Sprintf("%s/%s", outDirectory, v.Name()), fmt.Sprintf("%s/%s", romDirectory, v.Name()))
|
||||||
@ -182,6 +163,22 @@ func moveBuildArtifacts(outDirectory, romDirectory string) bool {
|
|||||||
return newROMs
|
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 /
|
// http - GET /
|
||||||
// Writes JSON response for the updater app to know what versions are available to download
|
// Writes JSON response for the updater app to know what versions are available to download
|
||||||
func lineageOSROMListHandler(w http.ResponseWriter, r *http.Request) {
|
func lineageOSROMListHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -208,6 +205,7 @@ 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) {
|
func hashFile(filename string) (string, error) {
|
||||||
f, err := os.Open(filename)
|
f, err := os.Open(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user