Compare commits

...

9 Commits

Author SHA1 Message Date
6b2118b53f Update extra/product.mk
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/promote/syncbuild Build is passing
continuous-integration/drone Build is passing
2024-11-11 06:25:50 -07:00
a09647cbaf go 1.23 isn't even out yet!
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2024-06-28 12:00:56 -06:00
9b3302dcf3 move from deadbeef.codes to code.stevenpolley.net
Some checks failed
continuous-integration/drone/push Build is failing
2024-06-28 11:55:35 -06:00
fb5b9864d9 Update README.md
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is failing
2023-09-11 17:38:31 +00:00
f72a33148d Update README.md
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-11 17:37:53 +00:00
5bdda0259a Add configurable baseURL (required for multi-device support)
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-21 19:47:49 -06:00
0b5eb36b5a Update docker compose example for device specific folder
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-19 21:58:25 -06:00
2921f5a76f update readme for device-specific ota URLs
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-19 21:52:24 -06:00
1f3209f55e fix string formatting bug causing mangled id's
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-10 18:08:34 -06:00
5 changed files with 19 additions and 18 deletions

View File

@ -3,7 +3,7 @@ name: default
workspace:
base: /go
path: src/deadbeef.codes/steven/lineageos-ota-server
path: src/code.stevenpolley.net/steven/lineageos-ota-server
steps:
@ -22,4 +22,4 @@ steps:
- name: package in docker container
image: plugins/docker
settings:
repo: registry.deadbeef.codes/lineageos-ota-server
repo: registry.stevenpolley.net/lineageos-ota-server

View File

@ -24,7 +24,7 @@ version: '3.8'
- "8080"
volumes:
- /data/android/lineage/out/target/product/sunfish:/out
- /data/android/public:/public
- /data/android/public/sunfish:/public
```
@ -34,21 +34,17 @@ The recommended way is to include the configuration inside your build of the ROM
Create new file /data/android/lineage/vendor/lineage/build/core/deadbeef-ota.mk
```makefile
# deadbeef.codes LineageOS OTA update server - replace with your own URL
ADDITIONAL_SYSTEM_PROPERTIES += \
lineage.updater.uri=https://lineageos-ota.deadbeef.codes
```
Edit /data/android/lineage/vendor/lineage/build/core/main.mk to include deadbeef-ota.mk
Edit (create if not exist) /data/android/lineage/vendor/extra/product.mk
```makefile
# Include LineageOS versions
include $(TOPDIR)vendor/lineage/build/core/main_version.mk
# Include deadbeef.codes OTA server
include $(TOPDIR)vendor/lineage/build/core/deadbeef-ota.mk
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
lineage.updater.uri=https://lineageos-ota-{device}.stevenpolley.net
# Default ADB shell
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
persist.sys.adb.shell=/system_ext/bin/bash
```

2
go.mod
View File

@ -1,3 +1,3 @@
module deadbeef.codes/steven/lineageos-ota-server
go 1.20
go 1.22

View File

@ -39,13 +39,18 @@ const (
cacheFile = "public/romcache.json" // persistence between server restarts so we don't have to rehash all the ROM files each time the program starts
)
var ( // evil global variable
var ( // evil global variables
romCache ROMCache
baseURL string
)
func init() {
// intialize and load ROMCache from file - so we don't have to rehash all the big files again
romCache = ROMCache{}
baseURL = os.Getenv("baseurl")
if len(baseURL) < 1 {
log.Fatalf("required environment variable 'baseurl' is not set.")
}
romCacheJson, err := os.ReadFile(cacheFile)
if err != nil {
@ -140,7 +145,7 @@ func updateROMCache() {
ID: fileHash,
Romtype: splitName[3], // UNOFFICIAL
Size: int(fInfo.Size()),
URL: fmt.Sprintf("https://lineageos-ota.deadbeef.codes/public/%s", v.Name()),
URL: fmt.Sprintf("%s/public/%s", baseURL, v.Name()),
Version: splitName[1],
}

View File

@ -61,7 +61,7 @@ func hashFile(filename string) (string, error) {
return "", fmt.Errorf("failed to copy data from file to hash function: %v", err)
}
return string(h.Sum(nil)), nil
return fmt.Sprintf("%x", h.Sum(nil)), nil
}
// false if a file is not a LineageOS ROM .zip file