mirror of
https://github.com/wcbing/wcbing-apt-repo.git
synced 2025-12-29 02:28:30 +08:00
init
This commit is contained in:
commit
6f8051ab74
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
get/module/__pycache__/
|
||||||
|
deb/
|
||||||
|
deb.db
|
||||||
18
README.md
Normal file
18
README.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# wcbing(APT)软件源/仓库
|
||||||
|
|
||||||
|
供 Debian 系发行版用户使用的软件源,收集一些国内常用软件的二进制包。
|
||||||
|
|
||||||
|
收录的软件说明:
|
||||||
|
- 发布的是已打包的文件,不接受源码和自行打包。
|
||||||
|
- 有固定的更新地址,如官网和 Github Releases。
|
||||||
|
- 现只收录了 x86_64。
|
||||||
|
|
||||||
|
## 使用现有仓库
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo curl -o /etc/apt/keyrings/wcbing.gpg https://deb.wcbing.top/wcbing.gpg
|
||||||
|
|
||||||
|
echo "deb [signed-by=/etc/apt/keyrings/wcbing.gpg] https://deb.wcbing.top /" | sudo tee /etc/apt/sources.list.d/wcbing.list
|
||||||
|
```
|
||||||
|
|
||||||
|
接下来执行 `sudo apt update` 更新即可。
|
||||||
46
get/module/check.py
Normal file
46
get/module/check.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import requests
|
||||||
|
import os
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
|
||||||
|
def check_download(name, version, url, arch="x86_64"):
|
||||||
|
conn = sqlite3.connect("deb.db")
|
||||||
|
cur = conn.cursor()
|
||||||
|
|
||||||
|
res = cur.execute(
|
||||||
|
"SELECT version, url FROM " + arch + " WHERE name = ?", (name,)
|
||||||
|
).fetchall()
|
||||||
|
if len(res):
|
||||||
|
db_version = res[0][0]
|
||||||
|
db_url = res[0][1]
|
||||||
|
print(name + ": " + db_version)
|
||||||
|
if db_version != version:
|
||||||
|
print("└ Update: " + db_version + " -> " + version)
|
||||||
|
# remove old version
|
||||||
|
old_file_path = os.path.join("deb", str(db_url.split("/")[-1]))
|
||||||
|
if os.path.exists(old_file_path):
|
||||||
|
os.remove(old_file_path)
|
||||||
|
# download
|
||||||
|
file_path = os.path.join("deb", str(url.split("/")[-1]))
|
||||||
|
with open(file_path, "wb") as fw:
|
||||||
|
fw.write(requests.get(url).content)
|
||||||
|
# wirte to db
|
||||||
|
cur.execute(
|
||||||
|
"UPDATE " + arch + " SET version = ?, url = ? WHERE name = ?",
|
||||||
|
(version, url, name),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
print(name + "\n└ Add: " + version)
|
||||||
|
# download
|
||||||
|
file_path = os.path.join("deb", str(url.split("/")[-1]))
|
||||||
|
with open(file_path, "wb") as fw:
|
||||||
|
fw.write(requests.get(url).content)
|
||||||
|
# wirte to db
|
||||||
|
cur.execute(
|
||||||
|
"INSERT INTO " + arch + "(name, version, url) VALUES (?, ?, ?)",
|
||||||
|
(name, version, url),
|
||||||
|
)
|
||||||
|
|
||||||
|
cur.close()
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
31
init.py
Executable file
31
init.py
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
# create dir
|
||||||
|
os.mkdir("deb")
|
||||||
|
|
||||||
|
# create table
|
||||||
|
conn = sqlite3.connect("deb.db")
|
||||||
|
conn.execute(
|
||||||
|
"""
|
||||||
|
CREATE TABLE IF NOT EXISTS x86_64 (
|
||||||
|
name TEXT UNIQUE,
|
||||||
|
version TEXT,
|
||||||
|
url TEXT
|
||||||
|
);
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
# conn.execute(
|
||||||
|
# """
|
||||||
|
# CREATE TABLE IF NOT EXISTS arm64 (
|
||||||
|
# name TEXT UNIQUE,
|
||||||
|
# version TEXT,
|
||||||
|
# url TEXT
|
||||||
|
# );
|
||||||
|
# """
|
||||||
|
# )
|
||||||
|
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
14
update_gen.sh
Normal file
14
update_gen.sh
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# check for updates
|
||||||
|
date
|
||||||
|
find get -maxdepth 1 -type f -name "*.py" -exec python3 {} \;
|
||||||
|
|
||||||
|
# generate the files
|
||||||
|
cd deb
|
||||||
|
apt-ftparchive packages . > Packages
|
||||||
|
apt-ftparchive release . > Release
|
||||||
|
gpg --yes --armor --detach-sign --sign -o Release.gpg Release
|
||||||
|
gpg --yes --clearsign -o InRelease Release
|
||||||
|
|
||||||
|
echo done
|
||||||
Loading…
x
Reference in New Issue
Block a user