mirror of
https://github.com/RubyMetric/chsrc
synced 2025-07-24 01:09:34 +08:00
Rewrite openSUSE Leap
recipe
This commit is contained in:
parent
a3a8127543
commit
78e863a2a1
@ -1,12 +1,15 @@
|
||||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Heng Guo <2085471348@qq.com>
|
||||
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Created On : <2023-09-17>
|
||||
* Last Modified : <2025-07-21>
|
||||
* File Authors : Heng Guo <2085471348@qq.com>
|
||||
* Contributors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Created On : <2023-09-17>
|
||||
* Major Revision : 1
|
||||
* Last Modified : <2025-07-21>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
#include "rawstr4c.h"
|
||||
|
||||
/**
|
||||
* @update 2025-06-20
|
||||
*/
|
||||
@ -30,54 +33,17 @@ def_sources_n(os_opensuse);
|
||||
|
||||
|
||||
/**
|
||||
* HELP: 未经测试
|
||||
* @consult https://mirrors.tuna.tsinghua.edu.cn/help/opensuse/
|
||||
*/
|
||||
void
|
||||
os_opensuse_setsrc (char *option)
|
||||
{
|
||||
chsrc_ensure_root (); // HELP: 不知道是否需要确保root权限
|
||||
chsrc_ensure_root ();
|
||||
|
||||
chsrc_yield_source_and_confirm (os_opensuse);
|
||||
|
||||
char *source_nselect = "zypper mr -da";
|
||||
chsrc_run (source_nselect, RunOpt_Default);
|
||||
|
||||
char *cmd1 = xy_strjoin (3,
|
||||
"zypper ar -cfg '",
|
||||
source.url,
|
||||
"/opensuse/distribution/leap/$releasever/repo/oss/' mirror-oss");
|
||||
char *cmd2 = xy_strjoin (3,
|
||||
"zypper ar -cfg '",
|
||||
source.url,
|
||||
"/opensuse/distribution/leap/$releasever/repo/non-oss/' mirror-non-oss");
|
||||
char *cmd3 = xy_strjoin (3,
|
||||
"zypper ar -cfg '",
|
||||
source.url,
|
||||
"/opensuse/distribution/leap/$releasever/oss/' mirror-update");
|
||||
char *cmd4 = xy_strjoin (3,
|
||||
"zypper ar -cfg '",
|
||||
source.url,
|
||||
"/opensuse/distribution/leap/$releasever/non-oss/' mirror-update-non-oss");
|
||||
char *cmd5 = xy_strjoin (3,
|
||||
"zypper ar -cfg '",
|
||||
source.url,
|
||||
"/opensuse/distribution/leap/$releasever/sle/' mirror-sle-update");
|
||||
char *cmd6 = xy_strjoin (3,
|
||||
"zypper ar -cfg '",
|
||||
source.url,
|
||||
"/opensuse/distribution/leap/$releasever/backports/' mirror-backports-update");
|
||||
|
||||
chsrc_run (cmd1, RunOpt_Default);
|
||||
chsrc_run (cmd2, RunOpt_Default);
|
||||
chsrc_run (cmd3, RunOpt_Default);
|
||||
chsrc_run (cmd4, RunOpt_Default);
|
||||
|
||||
chsrc_note2 ("leap 15.3用户还需要添加sle和backports源");
|
||||
chsrc_note2 ("另外请确保系统在更新后仅启用了六个软件源,可以使用 zypper lr 检查软件源状态");
|
||||
chsrc_note2 ("并使用 zypper mr -d 禁用多余的软件源");
|
||||
|
||||
chsrc_run (cmd5, RunOpt_Default);
|
||||
chsrc_run (cmd6, RunOpt_Default);
|
||||
/* TODO: 实现 Tumbleweed 换源 */
|
||||
chsrc_run_as_bash_file (RAWSTR_os_openSUSE_leap_in_bash);
|
||||
|
||||
chsrc_determine_chgtype (ChgType_Untested);
|
||||
chsrc_conclude (&source);
|
||||
|
10
src/recipe/os/rawstr4c.h
Normal file
10
src/recipe/os/rawstr4c.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Generated by rawstr4c v0.2.2-2025/07/21
|
||||
*/
|
||||
|
||||
char RAWSTR_os_openSUSE_leap_in_bash[] = "\x23\x20\xe9\xa6\x96\xe5\x85\x88\xe7\xa6\x81\xe7\x94\xa8\xe5\xae\x98\xe6\x96\xb9\xe8\xbd\xaf\xe4\xbb\xb6\xe6\xba\x90\x0a\x7a\x79\x70\x70\x65\x72\x20\x6d\x72\x20\x2d\x64\x61\x0a\x0a\x7a\x79\x70\x70\x65\x72\x20\x61\x72\x20\x2d\x63\x66\x67\x20\x27\x40\x75\x72\x6c\x40\x2f\x64\x69\x73\x74\x72\x69\x62\x75\x74\x69\x6f\x6e\x2f\x6c\x65\x61\x70\x2f\x24\x72\x65\x6c\x65\x61\x73\x65\x76\x65\x72\x2f\x72\x65\x70\x6f\x2f\x6f\x73\x73\x2f\x27\x20\x6d\x69\x72\x72\x6f\x72\x2d\x6f\x73\x73\x0a\x7a\x79\x70\x70\x65\x72\x20\x61\x72\x20\x2d\x63\x66\x67\x20\x27\x40\x75\x72\x6c\x40\x2f\x64\x69\x73\x74\x72\x69\x62\x75\x74\x69\x6f\x6e\x2f\x6c\x65\x61\x70\x2f\x24\x72\x65\x6c\x65\x61\x73\x65\x76\x65\x72\x2f\x72\x65\x70\x6f\x2f\x6e\x6f\x6e\x2d\x6f\x73\x73\x2f\x27\x20\x6d\x69\x72\x72\x6f\x72\x2d\x6e\x6f\x6e\x2d\x6f\x73\x73\x0a\x7a\x79\x70\x70\x65\x72\x20\x61\x72\x20\x2d\x63\x66\x67\x20\x27\x40\x75\x72\x6c\x40\x2f\x75\x70\x64\x61\x74\x65\x2f\x6c\x65\x61\x70\x2f\x24\x72\x65\x6c\x65\x61\x73\x65\x76\x65\x72\x2f\x6f\x73\x73\x2f\x27\x20\x6d\x69\x72\x72\x6f\x72\x2d\x75\x70\x64\x61\x74\x65\x0a\x7a\x79\x70\x70\x65\x72\x20\x61\x72\x20\x2d\x63\x66\x67\x20\x27\x40\x75\x72\x6c\x40\x2f\x75\x70\x64\x61\x74\x65\x2f\x6c\x65\x61\x70\x2f\x24\x72\x65\x6c\x65\x61\x73\x65\x76\x65\x72\x2f\x6e\x6f\x6e\x2d\x6f\x73\x73\x2f\x27\x20\x6d\x69\x72\x72\x6f\x72\x2d\x75\x70\x64\x61\x74\x65\x2d\x6e\x6f\x6e\x2d\x6f\x73\x73\x0a\x0a\x7a\x79\x70\x70\x65\x72\x20\x61\x72\x20\x2d\x63\x66\x67\x20\x27\x40\x75\x72\x6c\x40\x2f\x75\x70\x64\x61\x74\x65\x2f\x6c\x65\x61\x70\x2f\x24\x72\x65\x6c\x65\x61\x73\x65\x76\x65\x72\x2f\x73\x6c\x65\x2f\x27\x20\x6d\x69\x72\x72\x6f\x72\x2d\x73\x6c\x65\x2d\x75\x70\x64\x61\x74\x65\x0a\x7a\x79\x70\x70\x65\x72\x20\x61\x72\x20\x2d\x63\x66\x67\x20\x27\x40\x75\x72\x6c\x40\x2f\x75\x70\x64\x61\x74\x65\x2f\x6c\x65\x61\x70\x2f\x24\x72\x65\x6c\x65\x61\x73\x65\x76\x65\x72\x2f\x62\x61\x63\x6b\x70\x6f\x72\x74\x73\x2f\x27\x20\x6d\x69\x72\x72\x6f\x72\x2d\x62\x61\x63\x6b\x70\x6f\x72\x74\x73\x2d\x75\x70\x64\x61\x74\x65\x0a";
|
||||
|
||||
char RAWSTR_os_openSUSE_tumbleweed_in_bash[] = "\x23\x20\xe9\xa6\x96\xe5\x85\x88\xe7\xa6\x81\xe7\x94\xa8\xe5\xae\x98\xe6\x96\xb9\xe8\xbd\xaf\xe4\xbb\xb6\xe6\xba\x90\x0a\x7a\x79\x70\x70\x65\x72\x20\x6d\x72\x20\x2d\x64\x61\x0a\x0a\x7a\x79\x70\x70\x65\x72\x20\x61\x72\x20\x2d\x63\x66\x67\x20\x27\x68\x74\x74\x70\x73\x3a\x2f\x2f\x6d\x69\x72\x72\x6f\x72\x73\x2e\x74\x75\x6e\x61\x2e\x74\x73\x69\x6e\x67\x68\x75\x61\x2e\x65\x64\x75\x2e\x63\x6e\x2f\x6f\x70\x65\x6e\x73\x75\x73\x65\x2f\x74\x75\x6d\x62\x6c\x65\x77\x65\x65\x64\x2f\x72\x65\x70\x6f\x2f\x6f\x73\x73\x2f\x27\x20\x6d\x69\x72\x72\x6f\x72\x2d\x6f\x73\x73\x0a\x7a\x79\x70\x70\x65\x72\x20\x61\x72\x20\x2d\x63\x66\x67\x20\x27\x68\x74\x74\x70\x73\x3a\x2f\x2f\x6d\x69\x72\x72\x6f\x72\x73\x2e\x74\x75\x6e\x61\x2e\x74\x73\x69\x6e\x67\x68\x75\x61\x2e\x65\x64\x75\x2e\x63\x6e\x2f\x6f\x70\x65\x6e\x73\x75\x73\x65\x2f\x74\x75\x6d\x62\x6c\x65\x77\x65\x65\x64\x2f\x72\x65\x70\x6f\x2f\x6e\x6f\x6e\x2d\x6f\x73\x73\x2f\x27\x20\x6d\x69\x72\x72\x6f\x72\x2d\x6e\x6f\x6e\x2d\x6f\x73\x73\x0a\x0a\x23\x20\xe5\x88\xb7\xe6\x96\xb0\xe8\xbd\xaf\xe4\xbb\xb6\xe6\xba\x90\x0a\x7a\x79\x70\x70\x65\x72\x20\x72\x65\x66\x0a";
|
||||
|
51
src/recipe/os/rawstr4c.md
Normal file
51
src/recipe/os/rawstr4c.md
Normal file
@ -0,0 +1,51 @@
|
||||
<!-- -----------------------------------------------------------
|
||||
! SPDX-License-Identifier: GPL-3.0-or-later
|
||||
! -------------------------------------------------------------
|
||||
! Config Type : rawstr4c (Markdown)
|
||||
! Config Authors: Aoran Zeng <ccmywish@qq.com>
|
||||
! Contributors : Nil Null <nil@null.org>
|
||||
! Created On : <2025-07-21>
|
||||
! Last Modified : <2025-07-21>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# rawstr4c input for OS
|
||||
|
||||
- prefix = `RAWSTR_os`
|
||||
- output = `:global-variable-only-header`
|
||||
- translate = `:hex`
|
||||
|
||||
## openSUSE
|
||||
|
||||
- namespace = `openSUSE`
|
||||
|
||||
### Leap
|
||||
|
||||
`openSUSE Leap` 换源脚本
|
||||
|
||||
```bash
|
||||
# 首先禁用官方软件源
|
||||
zypper mr -da
|
||||
|
||||
zypper ar -cfg '@url@/distribution/leap/$releasever/repo/oss/' mirror-oss
|
||||
zypper ar -cfg '@url@/distribution/leap/$releasever/repo/non-oss/' mirror-non-oss
|
||||
zypper ar -cfg '@url@/update/leap/$releasever/oss/' mirror-update
|
||||
zypper ar -cfg '@url@/update/leap/$releasever/non-oss/' mirror-update-non-oss
|
||||
|
||||
zypper ar -cfg '@url@/update/leap/$releasever/sle/' mirror-sle-update
|
||||
zypper ar -cfg '@url@/update/leap/$releasever/backports/' mirror-backports-update
|
||||
```
|
||||
|
||||
### Tumbleweed
|
||||
|
||||
`openSUSE Tumbleweed` 换源脚本
|
||||
|
||||
```bash
|
||||
# 首先禁用官方软件源
|
||||
zypper mr -da
|
||||
|
||||
zypper ar -cfg 'https://mirrors.tuna.tsinghua.edu.cn/opensuse/tumbleweed/repo/oss/' mirror-oss
|
||||
zypper ar -cfg 'https://mirrors.tuna.tsinghua.edu.cn/opensuse/tumbleweed/repo/non-oss/' mirror-non-oss
|
||||
|
||||
# 刷新软件源
|
||||
zypper ref
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user