Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

PR #187

Closed
wants to merge 3 commits into from
Closed

PR #187

wants to merge 3 commits into from

Conversation

2096779623
Copy link

@2096779623 2096779623 commented Jun 18, 2022

修复its-pointless

its准备跑路了

https://github.com/its-pointless/gcc_termux/blob/811b270ee996439a16f453ff6b646b28dffdad04/setup-pointless-repo.sh#L9

这个判断过时了

更改packages.termux.orgpackages.termux.dev

Grimler91最近又买了个termux.dev

现在packages.termux.org会被重定向到packages.termux.devpackages-cf.termux.org会被重定向到packages-cf.termux.dev

由于fosshost的问题,运气不好可能会500😅 ,等Fosshost修复

更改低于安卓7的提示

termux/termux-app#2740

关于换源的建议

把全部源砍掉,用官方的termux-change-repo

或者全部加上,或者挑一些速度快的()

国内源:https://github.com/termux/termux-packages/wiki/Mirrors#mirrors-hosted-in-china

国内源就有14个((((((

@2moe
Copy link
Owner

2moe commented Jun 18, 2022

Snipaste_2022-06-18_16-16-49

这个 PR 不太好,我甚至怀疑你根本没有测试过。
  1. 把北外源给吃掉了

我现在说你几句,可能会让你不开心,实际上是为了你好呀。
如果这是一场大型的考试,那你可能就欲哭无泪了。
这就相当于你在考试的时候,把答题卡填错区域了。
阅卷者可能会看在你这么辛苦的份上,给你 1 分,但不太可能给你高分。

@2moe
Copy link
Owner

2moe commented Jun 18, 2022

Snipaste_2022-06-18_16-23-21

假设你没有填错区域,那么我想问一下,为什么要把 batcat 给删了。

加入 batcat 的意义在于:在用户执行 pointless-repo 的脚本前,审核一下是否需要执行。

@2moe
Copy link
Owner

2moe commented Jun 18, 2022

setup-pointless-repo 脚本实际上来自 its-pointless/its-pointless.github.io 的 master 仓库
https://github.com/its-pointless/its-pointless.github.io/blob/master/setup-pointless-repo.sh
它里面已经区分了 21 和 24

如果它有问题的话,请直接反馈给它。

https://github.com/its-pointless/its-pointless.github.io/blob/4eed29018b9f4ca7045e8b124c2522cd21e6f7c3/setup-pointless-repo.sh#L12

@2moe
Copy link
Owner

2moe commented Jun 18, 2022

  1. 对于新版的 apt, 不建议直接使用 apt-key add 来添加密钥。
    在新版中,apt-key 的定义是 “ Deprecated APT key management utility”

在手册中,它有如下描述:

Use of apt-key is deprecated, except for the use of apt-key del in maintainer scripts to remove existing keys from the main keyring.
If such usage of apt-key is desired the additional installation of the GNU Privacy Guard suite (packaged in gnupg) is required.

关键词是 “deprecated”

对于第三方仓库,你可以把OpenPGP公钥文件放进 etc/apt/trusted.gpg.d
但是我个人认为,这不是最佳的解决方案。
如果这个公钥出错了,那么其他源在更新时也会报错。
更合理的做法是将公钥放进 usr/share/keyrings 或者其他自定义目录,并在源中指定 keyring。

@2096779623
Copy link
Author

2096779623 commented Jun 18, 2022

setup-pointless-repo 脚本实际上来自 its-pointless/its-pointless.github.io 的 master 仓库 https://github.com/its-pointless/its-pointless.github.io/blob/master/setup-pointless-repo.sh 它里面已经区分了 21 和 24

如果它有问题的话,请直接反馈给它。

https://github.com/its-pointless/its-pointless.github.io/blob/4eed29018b9f4ca7045e8b124c2522cd21e6f7c3/setup-pointless-repo.sh#L12

21实际上是安卓5~6
24是安卓7+

目前官方的安卓5源格式:

deb https://packages.termux.dev/termux-main-21 stable main

目前官方的安卓7源格式:

deb https://packages.termux.dev/termux-main-21 stable main

问题是上次commit在21 Jun 2021

看看他的issues,全乱套了(

@2096779623
Copy link
Author

2096779623 commented Jun 18, 2022

  1. 对于新版的 apt, 不建议直接使用 apt-key add 来添加密钥。
    在新版中,apt-key 的定义是 “ Deprecated APT key management utility”

在手册中,它有如下描述:

Use of apt-key is deprecated, except for the use of apt-key del in maintainer scripts to remove existing keys from the main keyring.
If such usage of apt-key is desired the additional installation of the GNU Privacy Guard suite (packaged in gnupg) is required.

关键词是 “deprecated”

对于第三方仓库,你可以把OpenPGP公钥文件放进 etc/apt/trusted.gpg.d 但是我个人认为,这不是最佳的解决方案。 如果这个公钥出错了,那么其他源在更新时也会报错。 更合理的做法是将公钥放进 usr/share/keyrings 或者其他自定义目录,并在源中指定 keyring。

修改成:

deb [trusted=yes] https://its-pointless.github.io/files/24 termux extras

这样就不需要gpg公钥

@2moe
Copy link
Owner

2moe commented Jun 18, 2022

  1. 你如果是 tmoe 用户,那么应该已经认真阅读过文档。

尽管文档还在不断完善,但是 repo 相关的内容已经谈到了一点点。

新版将会使用 apt install xxx-repo 的方式来添加软件仓库。

其实我之前已经打过 bfsu 的 termux repo, 两周前被我删掉了 ( 注:源格式是更现代化的 deb-822)
但是我发现,这样做会导致 termux 的 pkg 出问题。
pkg 会读取 sources.list (传统的 one-line-style)

我在犹豫要不要打包,准确来说要不要打兼容 "one-line-style" 的包。

实际上,我并不太想这么做。

@2moe
Copy link
Owner

2moe commented Jun 18, 2022

  1. 关于 curl 的问题

安装tmoe必须要curl

实际上,新版不打算依赖 curl
你如果用 aria2c 的话,我会更开心的。
当然,如果你用 rust 的话,那我会更更开心的。

src/lib.rs

pub mod download;

src/download/mod.rs

use error_chain::error_chain;
use std::fs::File;
use std::io::copy;
use std::path::{Path, PathBuf};

error_chain! {
     foreign_links {
         Io(std::io::Error);
         HttpRequest(reqwest::Error);
     }
}

#[tokio::main]
pub async fn download_file(
    url: &str,
    file_dir: &Path,
    default_name: &str,
) -> Result<()> {
    let response = reqwest::get(url).await?;

    let mut file = {
        let file_name = response
            .url()
            .path_segments()
            .and_then(|segments| segments.last())
            .and_then(|name| {
                if name.is_empty() {
                    None
                } else {
                    Some(name)
                }
            })
            .unwrap_or(default_name);

        println!(r#"文件名称: "{}""#, file_name);
        let file_path: PathBuf = file_dir.join(file_name);
        println!("文件路径: {:?}", file_path);
        File::create(file_path)?
    };
    let content = response.text().await?;
    copy(&mut content.as_bytes(), &mut file)?;
    Ok(())
}

src/main.rs

use your_rust_crate_name::download::download_file;
use std::path::Path;

fn main() {
    download_file(
        r#"https://its-pointless.github.io/pointless.gpg"#,
        Path::new("./"),
        "pointless.gpg",
    )
    .expect("Failed to download");
}

@2096779623
Copy link
Author

一个小脚本用aria2c

@2moe
Copy link
Owner

2moe commented Jun 18, 2022

这样就不需要gpg公钥

这是更合理的解决方案吗?

@2096779623
Copy link
Author

这样就不需要gpg公钥

这是更合理的解决方案吗?

非常合理

https://github.com/termux/termux-apt-repo#accessing-the-repository

@2moe
Copy link
Owner

2moe commented Jun 18, 2022

一个小脚本用aria2c

aria2 是 tmoe edition 2019 ~ 2021 的依赖。

Signed-off-by: 2096779623 <57583560+2096779623@users.noreply.github.com>
Signed-off-by: 2096779623 <57583560+2096779623@users.noreply.github.com>
@2096779623
Copy link
Author

一个小脚本用aria2c

aria2 是 tmoe edition 2019 ~ 2021 的依赖。

改好了

Signed-off-by: 2096779623 <admin@utermux.dev>
@2096779623
Copy link
Author

Snipaste_2022-06-18_16-16-49

这个 PR 不太好,我甚至怀疑你根本没有测试过。

  1. 把北外源给吃掉了

我现在说你几句,可能会让你不开心,实际上是为了你好呀。 如果这是一场大型的考试,那你可能就欲哭无泪了。 这就相当于你在考试的时候,把答题卡填错区域了。 阅卷者可能会看在你这么辛苦的份上,给你 1 分,但不太可能给你高分。

其实我一开始想加别的国内源,但是我又放弃了

@2096779623
Copy link
Author

2096779623 commented Jun 18, 2022

我是否能在Copyright加上许可证?

# --------------------------------
Files: share/old-version/share/termux/setup-pointless-repo
Copyright: 2022 2096779623 <admin@utermux.dev>
License: AGPL-3.0
https://www.gnu.org/licenses/agpl-3.0.txt

@2moe
Copy link
Owner

2moe commented Jun 18, 2022

抱歉,今天我的身体不适。
因此上面的语气可能会让您感到不舒服。

明天,如果身体好转的话,那我将告诉您这个PR的后续。
如果还是很糟糕的话,那可能又要去医院看看了。

@2moe
Copy link
Owner

2moe commented Jun 19, 2022

抱歉,这个 PR 可能合并不了。
昨天我太生气了,然后就把 termux extra 这个选项里面的功能基本上都删了。
(还没有 push 上去)

curlaria2 并没有优劣之分,只有适用条件的不同。
实际上,我很喜欢 curl
昨天那些只是气话。
bat & cat 砍掉也没关系,对不起,我昨天瞎了眼。


Snipaste_2022-06-18_21-42-19

下次提交 PR 前,您可以先发一个 issue。


就算要合并的话,这个 PR 我可能也要完全重写了。

对于 edition 2021:

保持原来的内容不变,加上下面两个函数:

modify_pointless_src_list() {
    local old_version new_version file
    old_version=$1
    new_version=$2
    file="$PREFIX/etc/apt/sources.list.d/pointless.list"
    sed -E \
        -e \
        "s@(files/)${old_version}@\1${new_version}@" \
        -i "$file"
}

fix_pointless_list() {
    if ((ANDROID_VERSION >= 7)); then
        modify_pointless_src_list 21 24
    else
        modify_pointless_src_list 24 21
    fi
}

在执行完 pointless 官方脚本后,执行 fix_pointless_list

上面的内容,我没有测试,可能会打错。

对于 edition 2022:
使用 deb-822-style

file: pointless-24.sources

name: pointless 24 github
# yes or no
enabled: yes
uris: https://its-pointless.github.io/files/24
suites: termux
# deb deb-src
types: deb
# architectures: aarch64 arm i686 x86_64
#trusted: yes
components: extras
signed-by: /data/data/com.termux/files/usr/share/keyrings/pointless.gpg

#-----------------
name: pointless 24 ustc
enabled: no
uris: https://mirrors.ustc.edu.cn/termux-its-pointless/24
suites: termux
types: deb
# architectures: aarch64 arm i686 x86_64
components: extras
signed-by: /data/data/com.termux/files/usr/share/keyrings/pointless.gpg

file: pointless-21.sources

name: pointless 21 github
# yes or no
enabled: yes
uris: https://its-pointless.github.io/files/21
suites: termux
# deb deb-src
types: deb
# architectures: aarch64 arm i686 x86_64
#trusted: yes
components: extras
signed-by: /data/data/com.termux/files/usr/share/keyrings/pointless.gpg

接着写与这个仓库相关的 Makefile 和 postinst 等脚本,最后把它打成 deb 包。

@2moe 2moe closed this Jun 19, 2022
@2096779623
Copy link
Author

抱歉,这个 PR 可能合并不了。 昨天我太生气了,然后就把 termux extra 这个选项里面的功能基本上都删了。 (还没有 push 上去)

curlaria2 并没有优劣之分,只有适用条件的不同。 实际上,我很喜欢 curl。 昨天那些只是气话。 bat & cat 砍掉也没关系,对不起,我昨天瞎了眼。

Snipaste_2022-06-18_21-42-19

下次提交 PR 前,您可以先发一个 issue。

就算要合并的话,这个 PR 我可能也要完全重写了。

对于 edition 2021:

保持原来的内容不变,加上下面两个函数:

modify_pointless_src_list() {
    local old_version new_version file
    old_version=$1
    new_version=$2
    file="$PREFIX/etc/apt/sources.list.d/pointless.list"
    sed -E \
        -e \
        "s@(files/)${old_version}@\1${new_version}@" \
        -i "$file"
}

fix_pointless_list() {
    if ((ANDROID_VERSION >= 7)); then
        modify_pointless_src_list 21 24
    else
        modify_pointless_src_list 24 21
    fi
}

在执行完 pointless 官方脚本后,执行 fix_pointless_list

上面的内容,我没有测试,可能会打错。

对于 edition 2022: 使用 deb-822-style

file: pointless-24.sources

name: pointless 24 github
# yes or no
enabled: yes
uris: https://its-pointless.github.io/files/24
suites: termux
# deb deb-src
types: deb
# architectures: aarch64 arm i686 x86_64
#trusted: yes
components: extras
signed-by: /data/data/com.termux/files/usr/share/keyrings/pointless.gpg

#-----------------
name: pointless 24 ustc
enabled: no
uris: https://mirrors.ustc.edu.cn/termux-its-pointless/24
suites: termux
types: deb
# architectures: aarch64 arm i686 x86_64
components: extras
signed-by: /data/data/com.termux/files/usr/share/keyrings/pointless.gpg

file: pointless-21.sources

name: pointless 21 github
# yes or no
enabled: yes
uris: https://its-pointless.github.io/files/21
suites: termux
# deb deb-src
types: deb
# architectures: aarch64 arm i686 x86_64
#trusted: yes
components: extras
signed-by: /data/data/com.termux/files/usr/share/keyrings/pointless.gpg

接着写与这个仓库相关的 Makefile 和 postinst 等脚本,最后把它打成 deb 包。

没事,Moe最可爱了呢😉

@2096779623
Copy link
Author

抱歉,这个 PR 可能合并不了。 昨天我太生气了,然后就把 termux extra 这个选项里面的功能基本上都删了。 (还没有 push 上去)

curlaria2 并没有优劣之分,只有适用条件的不同。 实际上,我很喜欢 curl。 昨天那些只是气话。 bat & cat 砍掉也没关系,对不起,我昨天瞎了眼。

Snipaste_2022-06-18_21-42-19

下次提交 PR 前,您可以先发一个 issue。

就算要合并的话,这个 PR 我可能也要完全重写了。

对于 edition 2021:

保持原来的内容不变,加上下面两个函数:

modify_pointless_src_list() {
    local old_version new_version file
    old_version=$1
    new_version=$2
    file="$PREFIX/etc/apt/sources.list.d/pointless.list"
    sed -E \
        -e \
        "s@(files/)${old_version}@\1${new_version}@" \
        -i "$file"
}

fix_pointless_list() {
    if ((ANDROID_VERSION >= 7)); then
        modify_pointless_src_list 21 24
    else
        modify_pointless_src_list 24 21
    fi
}

在执行完 pointless 官方脚本后,执行 fix_pointless_list

上面的内容,我没有测试,可能会打错。

对于 edition 2022: 使用 deb-822-style

file: pointless-24.sources

name: pointless 24 github
# yes or no
enabled: yes
uris: https://its-pointless.github.io/files/24
suites: termux
# deb deb-src
types: deb
# architectures: aarch64 arm i686 x86_64
#trusted: yes
components: extras
signed-by: /data/data/com.termux/files/usr/share/keyrings/pointless.gpg

#-----------------
name: pointless 24 ustc
enabled: no
uris: https://mirrors.ustc.edu.cn/termux-its-pointless/24
suites: termux
types: deb
# architectures: aarch64 arm i686 x86_64
components: extras
signed-by: /data/data/com.termux/files/usr/share/keyrings/pointless.gpg

file: pointless-21.sources

name: pointless 21 github
# yes or no
enabled: yes
uris: https://its-pointless.github.io/files/21
suites: termux
# deb deb-src
types: deb
# architectures: aarch64 arm i686 x86_64
#trusted: yes
components: extras
signed-by: /data/data/com.termux/files/usr/share/keyrings/pointless.gpg

接着写与这个仓库相关的 Makefile 和 postinst 等脚本,最后把它打成 deb 包。

image

下面这俩呢

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants