sxiii

[HOW-TO] Remix Any Linux with JWM window manager

Apr 24th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.42 KB | None | 0 0
  1. # Remix Any Linux with JWM window manager HOW-TO                       #
  2. # This work is based off Ubuntu 16.04. May differ for others distros   #
  3. # Written by Security XIII on 25 April 2016                            #
  4. # I wanted to make small distro with presentation software to boot fast and start presentation out of the box
  5. # So I hope this will help those who are unaware of the process. Here are some useful links:
  6. # 1. LiveCD customization (a bit outdated, see above) - https://help.ubuntu.com/community/LiveCDCustomization
  7. # 2. Installing JWM - http://ubuntuforums.org/showthread.php?t=174188
  8. # Following is instructions themselves. Before start, grab your remix ISO from your source.
  9. # Let's say we have remixing iso in a directory ~/remix
  10. cd ~/remix
  11. mkdir mnt                                         # Make directory to mount the ISO disk
  12. mount -o loop your-remix.iso mnt   # Mount the disk to mnt dir
  13. mkdir extract-cd                                  # Directory to unpack ISO
  14. sudo rsync -a mnt/ extract-cd                     # Copy ISO to our directory
  15. sudo unsquashfs mnt/casper/filesystem.squashfs    # Unpack the squashfs
  16. sudo mv squashfs-root edit                        # Let's name our unpacked FS "edit" for convenience
  17. sudo cp /etc/resolv.conf edit/etc/                # Make the internet work in chroot
  18. sudo cp /etc/hosts edit/etc/
  19. sudo mount --bind /dev/ edit/dev                  # Mount the important filesystems
  20. sudo mount --bind /proc/ edit/proc
  21. sudo mount -o bind /run/ edit/run                 # Mount additional filesystems
  22. sudo chroot edit                                  # Chroot inside the unpacked squashfs
  23. # WE ARE IN CHROOT NOW! #
  24. export HOME=/root
  25. export LC_ALL=C
  26. apt install xorg nano wget xz-utils build-essential libx11-dev gettext
  27. apt install libreoffice-impress
  28. cd home
  29. wget https://joewing.net/projects/jwm/releases/jwm-2.3.5.tar.xz --no-check-certificate
  30. tar xf jwm*.tar.xz
  31. cd jwm
  32. ./configure                                              # Hope everything went okay here!
  33. make                                                     # Compilation should take few minutes or less
  34. make install                                             # Let's install the JWM
  35. mkdir /usr/share/xsession
  36. nano /usr/share/xsession/jwm.desktop
  37. # Insert following text into the file - double check JWM exists, then save file Ctrl+O [enter]
  38. [Desktop Entry]
  39. Encoding=UTF-8
  40. Name=JWM
  41. Comment=This is the JWM window manager
  42. Exec=/usr/local/bin/jwm    
  43. Type=Application
  44. # End of text file
  45. echo "exec /usr/local/bin/jwm" > ~/.xsession
  46. # Let's say we finished our changes. Cleaning up procedure (to make resulting ISO lighter)
  47. apt clean
  48. apt autoclean
  49. rm -rf /tmp/*
  50. rm /var/lib/dbus/machine-id
  51. umount /proc || umount -lf /proc                     # Start to unmount our filesystem
  52. umount /sys
  53. umount /dev/pts
  54. exit                                                 # Let's finally exist chroot and get back to our env
  55. # WE ARE NOT IN CHROOT NOW! Chroot has ended here.   #
  56. sudo umount edit/dev                            
  57. sudo chmod +w extract-cd/casper/filesystem.manifest
  58. sudo su
  59. chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest
  60. exit
  61. sudo cp extract-cd/casper/filesystem.manifest extract-cd/install/filesystem.manifest-desktop
  62. sudo sed -i '/ubiquity/d' extract-cd/casper/filesystem.manifest-desktop
  63. sudo sed -i '/casper/d' extract-cd/casper/filesystem.manifest-desktop
  64. sudo rm extract-cd/casper/filesystem.squashfs
  65. sudo mksquashfs edit extract-cd/casper/filesystem.squashfs
  66. sudo su
  67. printf $(du -sx --block-size=1 edit | cut -f1) > extract-cd/casper/filesystem.size
  68. exit
  69. sudo nano extract-cd/README.diskdefines              # Edit DISKNAME here if you like
  70. cd extract-cd                                        # Let's recreate all the MD5SUMs
  71. sudo rm md5sum.txt                                   # We need to remove the old onces to start
  72. find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee md5sum.txt  
  73. #
  74. # CONGRADULATIONS IF YOU GET HERE! NOW LET'S BUILD THE OUR VERY-OWN CUSTOM-CRAFTED ISO! #
  75. #
  76. sudo mkisofs -D -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../mytestrelease.iso .
  77. # If everything went well, you will have the "mytestrelease.iso" laying in the ~/remix folder.
  78. # Good luck in your own way! Contact me if needed at securityxiii at gmail dot com.
Add Comment
Please, Sign In to add comment