Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curdir=`pwd`
- s_rootfs="rootfs"
- prefix=""
- action="cp"
- #Applications
- #Let's remove these applications and maybe put them into an sfs
- #A=( "leafpad" "solitaire-minesweeper-1.3-i486"
- #"gtkhash-0.6.0-i686-up" "leafpad" "MPlayer" "clipit" "geany" "get_java" \
- # "getflash" "get_libreoffice" "gnome-mplayer" "pfind" )
- #A=( "pupmd5sum" "screener" "bulldog-finder-4.1.1" "galculator" )
- A= ( "file-roller" "gparted" "gtkhash-thunar-plugin" "gnome-bluetooth-2.32.0" \
- "gpicview" "isomaster" "libical" "libvisual-0.4.0" "pburn-xslacko" \
- "pfilesearch" "pfilesearch" "pschedule" "thunar" "thunar-archive-plugin" \
- "thunar-volman" "mtpaint" )
- #Let's remove this desktop related stuff and move it into a different sfs
- #Core PUppy
- A2=( "pfontview" "Pup-Kview" "Pup-SysInfo" )
- #Dektop related stuff
- #B=( "desk_icon_theme_blue_moon_Slacko" "desk_icon_theme_stardust" \
- #"desk_icon_theme_zabuton" "desktop-file-utils" "gnome-menus" )
- #B=( "libgnomecanvas" "libxfce4ui" "libxfce4util" "libxfcegui4-4.10.0" \
- #"puppy_icon_theme" "pup-volume-monitor" "redshiftGUI-0.2.1" "retrovol" \
- #"pupx" "shared-mime-info" "soothe-theme" "xfce4-cpugraph-plugin-1.0.5" \
- #"xfce4-mixer-4.11.0" "xfce4-notifyd" "xfce4-panel" "xfce4-screenshooter-1.8.1" \
- #"xfce4-session" "xfce4-settings" "xfce4-terminal" "xfce4-whiskermenu-plugin" \
- #"xfconf" "xfdesktop" "xfwm4" )
- B=( "garcon" "hicolor-icon-theme" "libexo_lib-0.3.2" "libgtkhtml" "lxtask" \
- "netmon_wce" "mkwallpaper" )
- #Programming related stuff
- #C=( "libglade2" "libgladeui1_11" "puppybasic-2.5b" "subversion" "automake" )
- C=( "bacon" "flex" "gcc_dev" "git" "gcc_dev" "jimtcl" "make" "pkgconfig" \
- "tcl" )
- #Browser related stuff
- #D=( "libwebkitgtk-1.10.2" "libwebp-0.3.1" "gst-ffmpeg-0.10.13" \
- #"gst-plugins-base-0.10.36" "gst-plugins-good-0.10.31" "gstreamer-0.10.36" )
- D=( "midori-0.5.9" "ffconvert" "ffmpeg" "libcroco" "libsoup-2.42.2" "lynx2-8-7-i486" \
- "tazweb-1.6.2" )
- #Video Related stuff
- D2=( "libtheora" "libvpx" "schroedinger" )
- #Internet/networking reled stuff
- #E=( "pgprs" "ppp" "rp-pppoe" "samba" "Simple-File-Sharing_Samba4" \
- #"firewall_ng" "firewallstatus" "frisbee" )
- E=( "wvdial" "putty-0.60-2010-09-10-i486" "arp" "arp-scan" "axel-1.0a-1" "lcms" "neon" \
- "transmission" )
- #F=( "alsaequal" "alsa-lib" "alsa-utils" )
- #Sound Related stuff
- F=( "asunder-2.1-i486" "audiofile" "flac" "esound" "lame" "libao" "libid3tag" "libmad" \
- "libogg" "libvorbis" "lvm2" "mplayer_codecs_basic" )
- #Other Hardware and sound realted stuff
- #G=( "pTape-2.0" "bluez-4.99" "bluez-firmware-1.2")
- #Digital Camera related stuff
- H=( "libdc1394" "libdv" )
- #Printing, scaners and pdfs related stuff
- I=( "libgsf" "cups" "cups_pdf" "foomatic-filters" "ghostscript" "gtklp" "libspectre" \
- "libtiff" "sane-backends" )
- #I'm not sure what this stuff is fore
- J=( "bbc_provided" )
- #Misc. Command line tools
- K=( "gphotofs"
- #Core stuff to remove
- L=( "icu_unknown" "bash" "jasper" "parted" )
- All=( "${A[@]}" "${B[@]}" "${C[@]}" "${D[@]}" "${E[@]}" "${F[@]}" )
- #!/bin/sh
- curdir=`pwd`
- rootfs="$s_rootfs"
- xinteractive=1
- prefix=""
- unmount_vfs(){
- umount -l $curdir/$rootfs/dev 2>/dev/null
- umount -l $curdir/$rootfs/sys 2>/dev/null
- umount -l $curdir/$rootfs/proc 2>/dev/null
- #umount /mnt/wktaz 2>/dev/null
- #umount /mnt/wksfs 2>/dev/null
- }
- trap unmount_vfs EXIT
- trap unmount_vfs SIGKILL
- trap unmount_vfs SIGTERM
- xinteractive=1
- echo "PUPMODE='2'" > $curdir/$rootfs$prefix/etc/rc.d/PUPSTATE
- mkdir -p $curdir/$rootfs/proc;
- mkdir -p $curdir/$rootfs/sys
- mount -o rbind /proc $curdir/$rootfs/proc
- mount -t sysfs none $curdir/$rootfs/sys
- if [ $xinteractive -eq 1 ]; then
- echo "Removing block device files..."
- #rm -rf $curdir/$rootfs/dev/*
- #mount bind -t devtmpfs none $curdir/$rootfs/dev
- mount -o rbind /dev $curdir/$rootfs/dev
- cp -f /etc/resolv.conf $curdir/$rootfs/etc/resolv.conf
- fi
- copy_built_in(){
- set -x
- app=$1
- file_list="$curdir/$s_rootfs/root/.packages/builtin_files/$app"
- if [ "${target:0:1}" = "/" ]; then
- target_root="$target"
- else
- target_root="$curdir/$target"
- fi
- target_file_list="$target_root/root/.packages/builtin_files/$app"
- echo "file_list=$file_list"
- mkdir -p /tmp/trim_puppy
- exec 10<> /tmp/trim_puppy/fd_9
- subdir="/"
- mkdir -p /tmp/trim_puppy/
- rm "/tmp/trim_puppy/$app"
- touch "/tmp/trim_puppy/$app"
- while IFS=$'\n' read -r -d $'\n' -u10 line ; do
- line=`echo "$line" | tr -d '[:space:]'`
- if [ ! "${line:0:1}" = "/" ]; then
- line=$subdir$line
- fi
- echo $line>>"/tmp/trim_puppy/$app"
- if [ "${target:0:1}" = "/" ]; then
- target_prefixed="$target$line"
- target_root="$target"
- else
- target_root="$curdir/$target"
- target_prefixed="$curdir/$target$line"
- fi
- if [ "${s_rootfs:0:1}" = "/" ]; then
- source_prefixed="$s_rootfs$line"
- cd "$s_rootfs" #this is necessary for the cpio command below
- else
- source_prefixed="$curdir/$s_rootfs$line"
- cd "$curdir/$s_rootfs" #this is necessary for the cpio command below
- fi
- if [ -d "$source_prefixed" ]; then
- subdir="$line"
- echo ".$line" | cpio -pd "$target_root"
- subdir=${subdir%/}/
- else
- target_dir=`dirname $target_prefixed`
- if [ ! -d "$target_dir" ]; then
- source_dir=`dirname $line`
- echo ".$source_dir" | cpio -pd "$target_root"
- fi
- if [ ! "$arr_action" = "mv" ]; then
- cp -a -u "$source_prefixed" "$target_prefixed"
- else
- mv -uf "$file_list" "$source_prefixed" "$target_prefixed"
- mv -uf $target_file_list
- fi
- fi
- done 10< <( cat "$file_list" )
- exec 10>&-
- set +x
- if [ ! "$arr_action" = "mv" ]; then
- cp -a -u "$file_list" "$target_file_list"
- else
- mv -uf "$file_list" "$target_file_list"
- fi
- }
- for arr_name in C D E F; do
- eval "arr=( \"\${"$arr_name"[@]}\" )"
- arr_action=`$"$arr_name"_action`
- #Move is faster but perhaps copy is safer
- arr_action=${arr_action:-cp}
- set -x
- eval 'target="$'$arr_name'_target"'
- target=${target:-"$curdir/$arr_name"}
- set +x
- if [ "${s_rootfs:0:1}" = "/" ]; then
- s_rootfs_prefixed="$s_rootfs"
- else
- s_rootfs_prefixed="$curdir/$s_rootfs"
- fi
- for app in "${arr[@]}"; do
- echo "arr_action=$arr_action"
- case "$arr_action" in
- cp|mv)
- echo "app=$app"
- copy_built_in "$app"
- ;;
- #mv)
- # move_built_in()
- #;;
- #pet) #We might also want to convert to other package formats
- # mk_pet_fm_built_in()
- #;;
- esac
- if [ -f "/tmp/trim_puppy/$app" ]; then
- file_list="$curdir/$s_rootfs/root/.packages/builtin_files/$app"
- rm "$file_list"
- cp "/tmp/trim_puppy/$app" "$file_list"
- fi
- #chroot "$s_rootfs_prefixed" remove_builtin "$app"
- done
- done
- chroot "$s_rootfs_prefixed" remove_builtin "${All[@]}"
- if [ "$(mount | grep "$curdir/$rootfs/dev")" != "" ]; then
- umount -l $curdir/$rootfs/dev
- fi
- if [ "$(mount | grep "$curdir/$rootfs/sys")" != "" ]; then
- umount -l $curdir/$rootfs/sys
- fi
- if [ "$(mount | grep "$curdir$rootfs/proc")" != "" ]; then
- umount -l $curdir/$rootfs/proc
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement