Skip to content

Instantly share code, notes, and snippets.

@mp107 mp107/init.sh
Created Oct 20, 2018

Embed
What would you like to do?
#!/bin/bash
# Functions
put_directory()
{
SUBVOL_DIRECTORY="$1"
USER_DIRECTORY="$2"
echo "Put directory $SUBVOL_DIRECTORY in $USER_DIRECTORY"
if [ -e "${SUBVOL_DIRECTORY}" ]
then
if [ -e "${USER_DIRECTORY}" ]
then
mv "${USER_DIRECTORY}" "${USER_DIRECTORY}_old"
fi
ln -s "${SUBVOL_DIRECTORY}" "${USER_DIRECTORY}"
fi
}
put_icon()
{
ICON_PATH="$1"
echo "Put icon in $ICON_PATH"
shift
ICON_CONTENT=$@
cat > "${ICON_PATH}" <<EOF
${ICON_CONTENT}
EOF
}
# Script
# Variables
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
echo "Directory: ${DIR}"
DESKTOPDIR="$HOME/Desktop"
if [ -e "$HOME/Pulpit" ]
then
DESKTOPDIR="$HOME/Pulpit"
fi
echo "Desktop Directory: ${DESKTOPDIR}"
WINEPREFIXDIR="${HOME}/.wine_msoffice_2007"
echo "Wine prefix directory ${WINEPREFIXDIR}"
# Put directories
put_directory ${DIR}/wine_msoffice_2007 ${WINEPREFIXDIR}
# Put icons
ICON_CONTENT=\
"[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=env WINEPREFIX=\"${WINEPREFIXDIR}\" wine C:/Program\ Files/Microsoft\ Office/Office12/MSACCESS.EXE
Name=MS Access 2007
Icon=${WINEPREFIXDIR}/drive_c/Program Files/Microsoft Office/_icons/MSACCESS.png
"
put_icon "${DESKTOPDIR}/ms_access_2007.desktop" "$ICON_CONTENT"
ICON_CONTENT=\
"[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=env WINEPREFIX=\"${WINEPREFIXDIR}\" wine C:/Program\ Files/Microsoft\ Office/Office12/EXCEL.EXE
Name=MS Excel 2007
Icon=${WINEPREFIXDIR}/drive_c/Program Files/Microsoft Office/_icons/MSEXCEL.png
"
put_icon "${DESKTOPDIR}/ms_excel_2007.desktop" "$ICON_CONTENT"
ICON_CONTENT=\
"[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=env WINEPREFIX=\"${WINEPREFIXDIR}\" wine C:/Program\ Files/Microsoft\ Office/Office12/POWERPNT.EXE
Name=MS PowerPoint 2007
Icon=${WINEPREFIXDIR}/drive_c/Program Files/Microsoft Office/_icons/MSPOWERPOINT.png
"
put_icon "${DESKTOPDIR}/ms_powerpoint_2007.desktop" "$ICON_CONTENT"
ICON_CONTENT=\
"[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=env WINEPREFIX=\"${WINEPREFIXDIR}\" wine C:/Program\ Files/Microsoft\ Office/Office12/WINWORD.EXE
Name=MS Word 2007
Icon=${WINEPREFIXDIR}/drive_c/Program Files/Microsoft Office/_icons/MSWORD.png
"
put_icon "${DESKTOPDIR}/ms_word_2007.desktop" "$ICON_CONTENT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.