制作FC8 LiveCD并使用squashfs进行改动

本文档介绍了如何复制Fedora 8 LiveCD的基础和KDE配置文件,然后挂载ISO以便进行修改。通过加载squashfs模块,安装必要的工具,解压并修改LiveOS文件系统,添加或删除软件包,同步个人桌面设置,并最终创建新的定制ISO映像。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这篇东东是小强让我看的,得益匪浅呀。

原文出处:http://forums.fedoraforum.org/showthread.php?t=174916

  1. # I copy these files to /home and make adjustments there so the originals don't get hosed.
  2. livecd-fedora-8-base-desktop.ks
  3. livecd-fedora-8-kde.ks


  4. livecd-creator /
  5. --config=/home/livecd-fedora-8-kde.ks /
  6. --fslabel=Fedora-8-LiveCD-KDE


  7. # Mount the livecd iso so we can make some changes
  8. mkdir /home/iso
  9. mount -t iso9660 -o loop /home/Fedora-8-LiveCD-KDE.iso /home/iso


  10. # Check /home/iso for these files and folders
  11. GPL
  12. isolinux
  13. LiveOS
  14. README

  1. # You need to load the squashfs module

  2. (echo '#!/bin/sh'echo 'modprobe squashfs') /
  3. > /etc/sysconfig/modules/squashfs.modules
  4. chmod +x /etc/sysconfig/modules/squashfs.modules

  1. # You can enable the squashfs module without rebooting with this command:
  2. modprobe squashfs

  1. # Install squashfs-tools
  2. yum install squashfs-tools


  3. # The contents of the iso root filesystem is located in the file squashfs.img
  4. # Unpack squashfs.img to a folder called squashfs-root
  5. unsquashfs /home/iso/LiveOS/squashfs.img


  6. # Mount the /home/squashfs-root/LiveOS/ext3fs.img to a folder with the command:
  7. mkdir /home/livecd-root
  8. mount -o loop,rw /home/squashfs-root/LiveOS/ext3fs.img /home/livecd-root


  9. # Make some changes, For example:
  10. # Adding yum repos to the livecd environment
  11. rpm -ihv http://livna-dl.reloumirrors.net//
  12. fedora/8/i386/livna-release-8-1.noarch.rpm --root /home/livecd-root/


  13. rpm -ihv http://ayo.freshrpms.net/fedora/linux/8/i386//
  14. RPMS.freshrpms/freshrpms-release-1.1-1.fc.noarch.rpm --root /home/livecd-root/


  15. # Make a list of installed packages so you have a better idea
  16. # of what needs to be installed or removed
  17. rpm -qa --root /home/livecd-root/ | sort >list.txt


  18. # Add or remove packages with the yum package manager
  19. yum  install gimp --installroot=/home/livecd-root
  20. yum  remove ktorrent --installroot=/home/livecd-root
  21. yum  clean all --installroot=/home/livecd-root
  22. updatedb -U /home/livecd-root

  1. Copy your desktop settings to the livecd environment
  2. rm -rf /home/livecd-root/etc/skel
  3. mkdir /home/livecd-root/etc/skel
  4. rsync -av --exclude='.thunderbird' /home/fred/ /home/livecd-root/etc/skel
  5. chown -R root:root /home/livecd-root/etc/skel//.

  1. # Unmount the ext3fs.img and make a new squashfs.img
  2. umount /home/livecd-root
  3. mksquashfs squashfs-root squashfs.img

  1. # Create a folder called build for making the new iso image
  2. mkdir /home/build
  3. rsync -av --exclude='squashfs.img' /home/iso/ /home/build
  4. mv /home/squashfs.img /home/build/LiveOS
  5. umount /home/iso

  6. # When making a new iso image the cd volume label
  7. # needs to match the isolinux.cfg entry
  8. # ( root=CDLABEL=Fedora-8-LiveCD-KDE )
  9. cd /home/build

  10. mkisofs -R -l -L -D -b isolinux/isolinux.bin -c isolinux/boot.catalog -o /home/Modified-Fedora-8-LiveCD-KDE.iso -no-emul-boot -boot-load-size 4 -boot-info-table -V "Fedora-8-LiveCD-KDE" .

爬取网易云音乐需要使用到requests、BeautifulSoup和re等库,gui界面我们可以使用Tkinter来实现。下面是一个简单的爬取网易云音乐制作gui界面的示例代码: ```python import requests from bs4 import BeautifulSoup import webbrowser import tkinter as tk # 创建一个Tk窗口 root = tk.Tk() root.title("网易云音乐top500") # 创建列表框和滚动条 listbox = tk.Listbox(root, width=50, height=20) scrollbar = tk.Scrollbar(root) # 布局列表框和滚动条 listbox.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) scrollbar.pack(side=tk.RIGHT, fill=tk.Y) # 将滚动条绑定到列表框 listbox.config(yscrollcommand=scrollbar.set) scrollbar.config(command=listbox.yview) # 爬取网易云音乐top500 url = 'https://music.163.com/discover/toplist?id=3778678' response = requests.get(url) soup = BeautifulSoup(response.content, 'html.parser') songs = soup.find_all('span', class_='txt') # 遍历top500歌曲 for i, song in enumerate(songs): song_name = song.find('a').text song_artist = song.find('span', class_='s-fc8').text song_info = f'{i+1}:{song_name} - {song_artist}' # 将歌曲信息添加到列表框中 listbox.insert(tk.END, song_info) # 在网页中打开歌曲链接 song_id = re.search(r'song\?id=(\d+)', song.find('a')['href']).group(1) song_url = f'https://music.163.com/#/song?id={song_id}' def open_song(event, song_url=song_url): webbrowser.open(song_url) listbox.bind('<Double-Button-1>', open_song) # 进入主循环 root.mainloop() ``` 这个示例代码爬取了网易云音乐的top500歌曲信息,将它们显示在一个列表框中。你可以在列表框中双击歌曲信息,打开网页播放该歌曲。需要注意的是,爬取网站内容时一定要遵守网站的相关规定,不要进行不当的操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值