Compare commits
9 Commits
238dab70fe
...
main
Author | SHA1 | Date | |
---|---|---|---|
6b2118b53f | |||
a09647cbaf | |||
9b3302dcf3 | |||
fb5b9864d9 | |||
f72a33148d | |||
5bdda0259a | |||
0b5eb36b5a | |||
2921f5a76f | |||
1f3209f55e |
@ -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
|
||||
|
20
README.md
20
README.md
@ -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
|
||||
|
||||
```
|
9
main.go
9
main.go
@ -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],
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user