UOS(debian)构建字体deb安装包

admin 2022年10月13日 659次浏览

1、创建相关目录与文件

root@UOS-PC:# mkdir -p temp/DEBIAN temp/fonts
root@UOS-PC:# mkdir -p temp/usr/share/fonts/truetype/ms-core-font
root@UOS-PC:# touch temp/DEBIAN/{control,postinst}
root@UOS-PC:# chmod -R 755 temp/DEBIAN/*

2、编辑DEBIAN文件中的配置文件

  • control配置文件

    root@UOS-PC:# vim temp/DEBIAN/control
    Package: UOS-fonts
    Version: 1.0
    Section: font
    Priority: optional
    Architecture: arm64
    Maintainer: oldyan
    Description: 公文常用字体
    
  • postinst配置文件

    root@UOS-PC:# vim temp/DEBIAN/postinst
    #!/bin/bash
    [ ! -d /usr/share/fonts/truetype/ms-core-fonts/ ] && mkdir -p /usr/share/fonts/truetype/ms-core-fonts/
    cp /fonts/* /usr/share/fonts/truetype/ms-core-fonts/
    cd /usr/share/fonts/truetype/ms-core-fonts/
    mkfontscale && mkfontdir && fc-cache -fv
    

3、添加字体

将需要安装的字体添加到 fonts/ 目录中

4、打包字体

# 打包字体
root@UOS-PC:# dpkg-deb -b temp/ temp/font.deb
dpkg-deb: 正在 'temp/font.deb' 中构建软件包 'uos-fonts'。

# 查看打包结果
root@UOS-PC:# ls temp
font.deb

5、deb解包

root@UOS-PC:# dpkg-deb -x fonts.deb temp/
root@UOS-PC:# ls temp
fonts  usr