Checked scripts for syntax errors using shellcheck.
This commit is contained in:
parent
e18ef374c4
commit
8a4c5fd6d7
|
@ -1,25 +1,6 @@
|
||||||
#---------------- Copyright notices and creator info-----------------------------#
|
#!/bin/bash
|
||||||
#
|
|
||||||
# By Maxim F. Stewart Contact: [maximstewart1@gmail.com]
|
|
||||||
#
|
|
||||||
# Copyright 2013 Maxim F. Stewart
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#--------------------------------------------------------------------------------#
|
|
||||||
setup() {
|
setup() {
|
||||||
export HOME=/root
|
export HOME=/root
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
INSERT GPG KEY RETRIEVAL HERE
|
INSERT GPG KEY RETRIEVAL HERE
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
apt list --installed > temp.txt
|
||||||
|
echo "aptitude" >> temp.txt ## Apend aptitude to list
|
||||||
|
lineCount=$(wc -l temp.txt | awk '{printf $1}') ## Get line count minus one to remove first line
|
||||||
|
tail -n$((lineCount - 1)) temp.txt > cleanedList.sh ## Get all lines but the first
|
||||||
|
echo "aptitude markauto ~i \\ " > temp.txt
|
||||||
|
awk '{ FS = "/"} NF{printf " !~" $1}' cleanedList.sh >> temp.txt
|
||||||
|
rm cleanedList.sh
|
||||||
|
mv temp.txt cleanedList.sh
|
||||||
|
}
|
||||||
|
main;
|
|
@ -2,7 +2,7 @@
|
||||||
. CONFIG
|
. CONFIG
|
||||||
|
|
||||||
rootNisoChk() {
|
rootNisoChk() {
|
||||||
if [ $(id -u) -eq 0 ]; then
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
softChk
|
softChk
|
||||||
else
|
else
|
||||||
echo "Sorry, you are not root."
|
echo "Sorry, you are not root."
|
||||||
|
@ -20,10 +20,10 @@ genIso=$(which genisoimage) ## Iso maker
|
||||||
if [[ $xyphr == "" ]] || [[ $sysLnx == "" ]] || \
|
if [[ $xyphr == "" ]] || [[ $sysLnx == "" ]] || \
|
||||||
[[ $squash == "" ]] || [[ $genIso == "" ]]; then
|
[[ $squash == "" ]] || [[ $genIso == "" ]]; then
|
||||||
echo "## Missing some packages ##"
|
echo "## Missing some packages ##"
|
||||||
echo "Xephyr :" $xyphr
|
echo "Xephyr :" "${xyphr}"
|
||||||
echo "Syslinux :" $sysLnx
|
echo "Syslinux :" "${sysLnx}"
|
||||||
echo "Squashfs-tools :" $squash
|
echo "Squashfs-tools :" "${squash}"
|
||||||
echo "Genisoimage :" $genIso
|
echo "Genisoimage :" "${genIso}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Going to run :"
|
echo "Going to run :"
|
||||||
echo " apt-get install xserver-xephyr syslinux squashfs-tools genisoimage -y"
|
echo " apt-get install xserver-xephyr syslinux squashfs-tools genisoimage -y"
|
||||||
|
@ -37,8 +37,8 @@ genIso=$(which genisoimage) ## Iso maker
|
||||||
|
|
||||||
getIso() {
|
getIso() {
|
||||||
clear
|
clear
|
||||||
echo "## Download Ubuntu Mini Remix ##"
|
echo -e "## Download Ubuntu Mini Remix ##\n" \
|
||||||
echo "Would you like to download an Ubuntu Mini Iso?"
|
"Would you like to download an Ubuntu Mini Iso?"
|
||||||
read -p "(yY/Nn) --> " ANSR
|
read -p "(yY/Nn) --> " ANSR
|
||||||
while [[ $ANSR != "y" ]] && [[ $ANSR != "Y" ]] && \
|
while [[ $ANSR != "y" ]] && [[ $ANSR != "Y" ]] && \
|
||||||
[[ $ANSR != "n" ]] && [[ $ANSR != "N" ]]
|
[[ $ANSR != "n" ]] && [[ $ANSR != "N" ]]
|
||||||
|
@ -49,8 +49,8 @@ getIso() {
|
||||||
## Check if dl iso is wanted then dl it
|
## Check if dl iso is wanted then dl it
|
||||||
if [[ $ANSR == "Y" ]] || [[ $ANSR == "y" ]]; then
|
if [[ $ANSR == "Y" ]] || [[ $ANSR == "y" ]]; then
|
||||||
clear
|
clear
|
||||||
echo "## Default Settings Or Set Version And Arch ##"
|
echo -e "## Default Settings Or Set Version And Arch ##\n" \
|
||||||
echo " Would you like to use the default choices? "
|
"Would you like to use the default choices? "
|
||||||
read -p "(yY/Nn) --> " ANSR
|
read -p "(yY/Nn) --> " ANSR
|
||||||
while [[ $ANSR != "y" ]] && [[ $ANSR != "Y" ]] && \
|
while [[ $ANSR != "y" ]] && [[ $ANSR != "Y" ]] && \
|
||||||
[[ $ANSR != "n" ]] && [[ $ANSR != "N" ]]
|
[[ $ANSR != "n" ]] && [[ $ANSR != "N" ]]
|
||||||
|
@ -58,25 +58,25 @@ getIso() {
|
||||||
read -p "(yY/Nn) --> " ANSR
|
read -p "(yY/Nn) --> " ANSR
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $ANSR == "N" ] || [ $ANSR == "n" ]; then
|
if [ "${ANSR}" == "N" ] || [ "${ANSR}" == "n" ]; then
|
||||||
clear
|
clear
|
||||||
echo "## Get Version ##"
|
echo -e "## Get Version ##\n" \
|
||||||
echo "What version would you like?"
|
"What version would you like?\n" \
|
||||||
echo "Examples :"
|
"Examples :\n" \
|
||||||
echo " LTS : 16.04"
|
" LTS : 16.04\n" \
|
||||||
echo " Non-LTS : 15.10"
|
" Non-LTS : 15.10\n" \
|
||||||
echo "Be very sure you are correctly entering the version."
|
"Be very sure you are correctly entering the version."
|
||||||
read -p "Version --> : " VERSION
|
read -p "Version --> : " VERSION
|
||||||
clear
|
clear
|
||||||
echo "## Get Architect ##"
|
echo -e "## Get Architect ##\n" \
|
||||||
echo "What version would you like?"
|
"What version would you like?\n" \
|
||||||
echo " 32bit : i386"
|
" 32bit : i386\n" \
|
||||||
echo " 64bit : amd64"
|
" 64bit : amd64\n" \
|
||||||
echo "Be very sure you are correctly entering the architect."
|
"Be very sure you are correctly entering the architect."
|
||||||
read -p "Arch --> : " ARCH
|
read -p "Arch --> : " ARCH
|
||||||
wget http://ubuntu-mini-remix.mirror.garr.it/mirrors/ubuntu-mini-remix/${VERSION}/ubuntu-mini-remix-${VERSION}-${ARCH}.iso
|
wget http://ubuntu-mini-remix.mirror.garr.it/mirrors/ubuntu-mini-remix/"${VERSION}"/ubuntu-mini-remix-"${VERSION}"-"${ARCH}".iso
|
||||||
else
|
else
|
||||||
wget http://ubuntu-mini-remix.mirror.garr.it/mirrors/ubuntu-mini-remix/${VERSION}/ubuntu-mini-remix-${VERSION}-${ARCH}.iso
|
wget http://ubuntu-mini-remix.mirror.garr.it/mirrors/ubuntu-mini-remix/"${VERSION}"/ubuntu-mini-remix-"${VERSION}"-"${ARCH}".iso
|
||||||
main
|
main
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -85,24 +85,25 @@ getIso() {
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if [ ! -f *.iso ] && [ ! -d squashfs-root ]; then
|
list=$(find . -maxdepth 1 -name "*.iso" -printf '%P\n')
|
||||||
|
if [[ "${list}" == "" ]] && [ ! -d squashfs-root ]; then
|
||||||
clear
|
clear
|
||||||
echo "Sorry, there is no iso or squashfs-root dir to work with in the current directory."
|
echo -e "Sorry, there is no iso or squashfs-root dir to work with in the current directory.\n"
|
||||||
echo "Going back to download ans Ubuntu Mini Iso..."
|
"Going back to download an Ubuntu Mini Iso..."
|
||||||
sleep 4
|
sleep 4
|
||||||
getIso
|
getIso
|
||||||
elif [ -f *.iso ] && [ -d squashfs-root ]; then
|
elif [[ "${list}" != "" ]] && [ -d squashfs-root ]; then
|
||||||
clear
|
clear
|
||||||
echo "Both an iso and squashfs-root are present..."
|
echo -e "Both an iso and squashfs-root are present...\n"
|
||||||
echo "Which do you wish to use?"
|
"Which do you wish to use?"
|
||||||
read -p "1.) `echo *.iso`
|
read -p "1.) $(echo ./*.iso)
|
||||||
2.) Use former session: squashfs-root
|
2.) Use former session: squashfs-root
|
||||||
3.) Exit
|
3.) Exit
|
||||||
--> : " ANSR
|
--> : " ANSR
|
||||||
while [[ $ANSR != "1" ]] && [[ $ANSR != "2" ]] && \
|
while [[ $ANSR != "1" ]] && [[ $ANSR != "2" ]] && \
|
||||||
[[ $ANSR != "3" ]]
|
[[ $ANSR != "3" ]]
|
||||||
do
|
do
|
||||||
read -p "1.) `echo *.iso`
|
read -p "1.) $(echo ./*.iso)
|
||||||
2.) Use former session: squashfs-root
|
2.) Use former session: squashfs-root
|
||||||
3.) Exit
|
3.) Exit
|
||||||
--> : " ANSR
|
--> : " ANSR
|
||||||
|
@ -121,9 +122,9 @@ main() {
|
||||||
echo "Squashfs-root directory found. Chrooting to directory."
|
echo "Squashfs-root directory found. Chrooting to directory."
|
||||||
sleep 4
|
sleep 4
|
||||||
chrootr
|
chrootr
|
||||||
elif [ -f *.iso ]; then
|
elif [[ "${list}" != "" ]]; then
|
||||||
clear
|
clear
|
||||||
echo "Iso found; mounting and copying to proper file structure. Then chrooting in..."
|
echo "Iso(s) found. Will mount one and copying to proper file structure. Then will chroot in..."
|
||||||
sleep 4
|
sleep 4
|
||||||
mountAndCopy
|
mountAndCopy
|
||||||
chrootr
|
chrootr
|
||||||
|
@ -135,13 +136,21 @@ mountAndCopy() {
|
||||||
mkdir iso/ mnt/
|
mkdir iso/ mnt/
|
||||||
|
|
||||||
## Prep filesystem
|
## Prep filesystem
|
||||||
mount -o loop *.iso mnt/
|
isoList=($(find . -maxdepth 1 -name "*.iso" -printf '%P\n'))
|
||||||
|
x=0;
|
||||||
|
for i in "${isoList[@]}"; do
|
||||||
|
echo "$x - ${i}"
|
||||||
|
((x++))
|
||||||
|
done
|
||||||
|
echo "Chose the ISO from above using the number."
|
||||||
|
read -p "-->: " ANSR
|
||||||
|
echo "You chose : ${isoList[$ANSR]}"
|
||||||
|
mount -o loop ./"${isoList[$ANSR]}" mnt/
|
||||||
cp -r mnt/. iso/ && \
|
cp -r mnt/. iso/ && \
|
||||||
mv iso/casper/filesystem.squashfs .
|
mv iso/casper/filesystem.squashfs .
|
||||||
|
|
||||||
## Unspuashfs the squashfs
|
## Unspuashfs the squashfs
|
||||||
unsquashfs filesystem.squashfs && \
|
unsquashfs filesystem.squashfs && rm filesystem.squashfs
|
||||||
rm filesystem.squashfs
|
|
||||||
|
|
||||||
## Cleanup some prep items
|
## Cleanup some prep items
|
||||||
umount mnt/ && rmdir mnt/
|
umount mnt/ && rmdir mnt/
|
||||||
|
@ -182,7 +191,7 @@ setConfigs() {
|
||||||
|
|
||||||
|
|
||||||
## Recreate manifest and clean it Note: MUST be after all setting changes
|
## Recreate manifest and clean it Note: MUST be after all setting changes
|
||||||
chroot squashfs-root/ dpkg-query -W --showformat='${Package} ${Version}\n' | sudo tee iso/casper/filesystem.manifest
|
chroot squashfs-root/ dpkg-query -W --showformat="${Package} ${VERSION}\n" | sudo tee iso/casper/filesystem.manifest
|
||||||
cp -v iso/casper/filesystem.manifest iso/casper/filesystem.manifest-desktop
|
cp -v iso/casper/filesystem.manifest iso/casper/filesystem.manifest-desktop
|
||||||
for i in $REMOVE
|
for i in $REMOVE
|
||||||
do
|
do
|
||||||
|
@ -198,7 +207,7 @@ genSqush() {
|
||||||
|
|
||||||
## Write the filesystem.size file, which is needed by the installer:
|
## Write the filesystem.size file, which is needed by the installer:
|
||||||
chmod 644 iso/casper/filesystem.size
|
chmod 644 iso/casper/filesystem.size
|
||||||
printf $(sudo du -sx --block-size=1 squashfs-root/ | cut -f1) > iso/casper/filesystem.size
|
sudo du -sx --block-size=1 squashfs-root/ | cut -f1 > iso/casper/filesystem.size
|
||||||
chmod 444 iso/casper/filesystem.size
|
chmod 444 iso/casper/filesystem.size
|
||||||
|
|
||||||
## Calculate MD5
|
## Calculate MD5
|
||||||
|
@ -209,6 +218,6 @@ genSqush() {
|
||||||
genIsoImg() {
|
genIsoImg() {
|
||||||
## Generate Iso
|
## Generate Iso
|
||||||
cd iso/
|
cd iso/
|
||||||
sudo mkisofs -D -r -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../${NAME}.iso .
|
sudo mkisofs -D -r -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../"${NAME}".iso .
|
||||||
}
|
}
|
||||||
rootNisoChk
|
rootNisoChk
|
||||||
|
|
Loading…
Reference in New Issue